mysql is in /var/lib/mysql/[database]....how to transfer to my username?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
mysql is in /var/lib/mysql/[database]....how to transfer to my username?
Hi Keen Fellowman!
Currently mysql data is in /var/lib/mysql/[database] i want to transfer the data to my username coz currently it was owned by mysql in /var what am I going to do?
edit /etc/my.cnf? and put the database location inside?
Not sure what you mean, but you can change ownership for files in a directory by logging in as root and doing
chown -R username.username directoryname
in a terminal
where
username = your username
directoryname = the name of the directory.
This should change the directory itself as well as the files it contains to the username you specify.
If I change ownership supposed it is in /var/lib/mysql directory the increasing bytes consumed on my HDD are owned by /var/lib/mysql or by my [username]? /usr/home/nnnnname
what I want is to avoid /var to become full? I am running out of space in /var but my /usr/ is 100+G.
If limited space in /var is the only consideration, then you should resize your partitions. You DON'T want to start messing with the ownership of MySQL files. You will create more problems than you solve by doing so. Further, simply changing ownership will not solve your space issue, even if you "own" the files they will continue exist and take up space in /var
If limited space in /var is the only consideration, then you should resize your partitions. You DON'T want to start messing with the ownership of MySQL files. You will create more problems than you solve by doing so. Further, simply changing ownership will not solve your space issue, even if you "own" the files they will continue exist and take up space in /var
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Why not just edit my.cnf and change the location of your datafiles. You may have to do a mysqldump in order to move the database. However simply changing the permissions will not fix anything but most likely break the database.
Why not just edit my.cnf and change the location of your datafiles. You may have to do a mysqldump in order to move the database. However simply changing the permissions will not fix anything but most likely break the database.
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Code:
mysqldump [database name] > [dump file name]
all this does is make a backup of the database. so then you would edit the my.cnf file, change the database location, then recreate the mysql database using mysqldump again. However before you do this please check the syntax of this command and make sure that everything looks ok. especially if this is on a live server.
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Quote:
Originally Posted by RMLinux
can you give me the step by step procedure buddy.
Here is a high level step by step procedure. However again do your research and I nor LQ are responsible for lost data. Now without further adieu
1. do a mysql dump on your databases
2. stop mysql
3. move database files to new location
3. edit my.cnf to point to where new database files are located.
4. start mysql.
5. Connect to mysql and check each database for data integrity.
Again exercise extreme caution. And do not change any permissions on the database files. If you do mysql will surely throw a fit. If this is a live server I recommend that you do an image of the server for a full backup. If it is a test server than I would be kind of concerend. But I am guessing that this is a production server.
Here is a high level step by step procedure. However again do your research and I nor LQ are responsible for lost data. Now without further adieu
1. do a mysql dump on your databases
2. stop mysql
3. move database files to new location
3. edit my.cnf to point to where new database files are located.
4. start mysql.
5. Connect to mysql and check each database for data integrity.
Again exercise extreme caution. And do not change any permissions on the database files. If you do mysql will surely throw a fit. If this is a live server I recommend that you do an image of the server for a full backup. If it is a test server than I would be kind of concerend. But I am guessing that this is a production server.
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
you would change the datadir to /home/foo/. However you don't really need to change the permissions on the datafile as that will not restrict grow. Again just migrate the databases to a new partition with more space. Another suggestions could be to try and compact your databases.
you would change the datadir to /home/foo/. However you don't really need to change the permissions on the datafile as that will not restrict grow. Again just migrate the databases to a new partition with more space. Another suggestions could be to try and compact your databases.
I change datadir=/home/foo/mysql on my.cnf.
I restart my mysql and it works fine still I can create transaction.
The thing is it seems it is using the same old database the database in /var/lib/mysql because I add transaction on the foo/ settings and I shutdown my database I edited my.cnf and return to old settings the transaction that I created still appeared on the old database?
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043
Rep:
Not really sure. Try changing your basedir also just to see if that would work. But I don't think that would matter. Try adding a new database and see where the location for the database file goes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.