Move Mysql my.cnf
Hi,
After moving mysql to new location and adding symlink, is it required to edit my.cnf and add:
mysql.sock=new-location
datadir=new-location
?
And why when new database is created does it get created ( symlink i guess) in /var/lib/mysql as well as new location?
-
Hello :) It depends on how you moved the MySQL directory. If you added a symbolic link, then technically it's not required to modify the "datadir" or "mysql.sock" entries in the /etc/my.cnf file. Additional symbolic links are not required if you already created one for the /var/lib/mysql location. Thank you. 0 -
Hi, thanks for your help. The way we moved mysql was basically; etc/init.d/mysql stop ]mkdir /data/mysql mv /var/lib/mysql /data/mysql chown -R mysql:mysql /data/mysql ln -s /data/mysql/mysql /var/lib/mysql /etc/init.d/mysql start
So why when a new database is created does a link get created in /var/lib/mysql to /data/mysql / ? Can we not edit my.cnf so any call to a database goes to the new location directly rather than to /var/lib/mysql > read link to new database location > database ? Regards.0 -
The steps you completed should be sufficient. Are you experiencing trouble with MySQL after making those changes? Thank you. 0 -
Hi, No trouble, am looking for efficiency and speed. Just wanting a call for any database to go straight to the new location instead of via /var/lib/mysql link to user_database in new location. Also wanting any new database to be created in the new location only, without adding a link to it in /var/lib/mysql . As it is, if I were to delete a link in /var/lib/mysql the database in its new location would vanish. 0 -
You could add or edit the following entry in the /etc/my.cnf file: datadir=/path/to/new/mysql
However, to clarify, are you actually running out of space in the /var partition? Thank you.0 -
Hi, Adding datadir=/path/to/new/mysql does not make any difference. Create a new database and it gets created in new location /data/mysql but a link to it also gets created in /var/lib/mysql No disk space is not a problem, we added a SSD drive and moved mysql onto it to increase access speed. 0 -
Feel free to open a support ticket if you would like us to take a closer look. I'm not sure exactly how your existing configuration looks so it's difficult to give an accurate answer. Note that symbolic links should not actually result in reduced performance. Thank you. 0
Please sign in to leave a comment.
Comments
7 comments