I have this weird problem after changing the MySQL datadir location from default "/var/lib/mysql" It was working yesterday, but today I get "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'," a typical message if the daemon is not running and it's looking for the socket file in the old datadir location.
I changed the my.cnf file and mysqld file to point to the new location, NEW_DIR. The daemon runs, but I cannot open mysql.
Thanks in advance.
# cat /etc/my.cnf [mysqld] datadir=/NEW_DIR/mysql socket=/NEW_DIR/mysql/mysql.sock # cat /etc/init.d/mysqld | grep datadir get_mysql_option mysqld datadir "/NEW_DIR/mysql" datadir="$result" get_mysql_option mysqld socket "$datadir/mysql.sock" # /etc/init.d/mysqld start Starting MySQL: [ OK ] # tail mysqld.log 120203 11:12:20 mysqld started 120203 11:12:20 InnoDB: Started; log sequence number 0 43655 120203 11:12:20 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.0.77' socket: '/NEW_DIR/mysql/mysql.sock' port: 3306 Source distribution # mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)