I lose my symlink when I restart mysql

Citizen

Active Member
Sep 3, 2012
28
0
1
cPanel Access Level
Root Administrator
A bit ago, I moved my mysql directory from /var/lib/mysql to /home/lib/mysql. In those steps I created a symlink

ln -s /home/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock

Which worked great. Today, I had to restart mysql through WHM. When I do, it says it failed and mysql isn't running. Trying again doesn't work. However, if i add the symlink again, it works perfecty, I don't need to do anything else. So now whenever I restart mysql I also have to replace the symlink. Is there a permanent fix that I can do so that I don't have to do this?
 

NixTree

Well-Known Member
Aug 19, 2010
413
5
143
Gods Own Country
cPanel Access Level
Root Administrator
Twitter
A bit ago, I moved my mysql directory from /var/lib/mysql to /home/lib/mysql. In those steps I created a symlink

ln -s /home/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock

Which worked great. Today, I had to restart mysql through WHM. When I do, it says it failed and mysql isn't running. Trying again doesn't work. However, if i add the symlink again, it works perfecty, I don't need to do anything else. So now whenever I restart mysql I also have to replace the symlink. Is there a permanent fix that I can do so that I don't have to do this?
I am not sure, what made you to choose a symlink for socket? Anyway, the proper way to changemysql socket file location is by editing /etc/my.cnf file. Open my.cnf file, under [mysqld] section add socket=/home/lib/mysql/mysql.sock and restart mysql.
 

Citizen

Active Member
Sep 3, 2012
28
0
1
cPanel Access Level
Root Administrator
I did. That's why this doesnt' make any sense.

My etc/my.cnf reads:

[mysqld]
datadir = /home/lib/mysql
socket = /home/lib/mysql/mysql.sock