I've changed data directory in /etc/my.cnf.
datadir=/data/mysql
socket=/data/mysql/mysql.sock
I also moved mysql folder from
/var/lib/mysql/
to
/data/mysql
Now when i connect to mysql i get following error:
[root@youradstats-copy mysql]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
also when i see /var/logs/msqld.log i get following messages in that:
InnoDB: Setting log file /data/mysql/ib_logfile0 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
120704 7:43:31 InnoDB: Log file /data/mysql/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /data/mysql/ib_logfile1 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
InnoDB: Cannot initialize created log files because
InnoDB: data files are corrupt, or new data files were
InnoDB: created when the database was started previous
InnoDB: time but the database was not shut down
InnoDB: normally after that.
120704 7:43:36 [ERROR] Plugin 'InnoDB' init function returned error.
120704 7:43:36 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
I shut down mysql properly before doing these changes and then started it properly but dont know why getting these messages. please help to solve issue as i have changed socket path in my.cnf but still its pointing to old path…
Best Answer
Check to see if you have the socket file in the new location?
ls -la /data/mysql/mysql.sock
If it exists, are the permissions correct? Show us if you're unsure.
The next step if it exists is to try:
If that works then you simply need to change the
sock=/path/
in the[client]
section of yourmy.cnf
file. If that doesn't exist there, then you should create it.It is not required to restart mysql when you change things in the
[client]
section of themy.cnf
file.On another note, the log messages you posted makes it looks like you did not copy the data from your
/var/lib/mysql/
directory properly, or you have a permissions issue. If you're unsure, show us the output ofls -la /data/mysql/