mysql is not connecting after data directory change

Posted by user123827 on Server Fault See other posts from Server Fault or by user123827
Published on 2012-07-04T14:56:10Z Indexed on 2012/07/04 15:17 UTC
Read the original article Hit count: 479

Filed under:
|

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...

© Server Fault or respective owner

Related posts about linux

Related posts about mysql