Today i have changed the mysql datadir directory default to new one
This is the steps which i followed to change
[root@testing-server~]# service mysqld stop
[root@testing-server~]# mkdir /wesites/mysql
[root@testing-server~]# cp -prvf /var/lib/mysql /websites/mysql/
[root@testing-server~]# vim /etc/my.cnf
datadir=/websites/mysql
socket=/websites/mysql/mysql.sock
[root@testing-server~]# service mysql start
After these steps mysql started but i can't able to login locally. i got the error instead of successful login
Solution :
I have added the following things on /etc/my.cnf file
[root@testing-server~]# vim /etc/my.cnf
[client]
socket=/websites/mysql/mysql.sock
[root@testing-server~]# service mysql restart
Now i can able to login locally
This is the steps which i followed to change
[root@testing-server~]# service mysqld stop
[root@testing-server~]# mkdir /wesites/mysql
[root@testing-server~]# cp -prvf /var/lib/mysql /websites/mysql/
[root@testing-server~]# vim /etc/my.cnf
datadir=/websites/mysql
socket=/websites/mysql/mysql.sock
[root@testing-server~]# service mysql start
After these steps mysql started but i can't able to login locally. i got the error instead of successful login
Solution :
I have added the following things on /etc/my.cnf file
[root@testing-server~]# vim /etc/my.cnf
[client]
socket=/websites/mysql/mysql.sock
[root@testing-server~]# service mysql restart
Now i can able to login locally
No comments:
Post a Comment