LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to fix MySQL issue (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-fix-mysql-issue-4175588358/)

tushar.jadhav29 08-30-2016 05:19 PM

How to fix MySQL issue
 
I had changed MySQL home directory path from /var/lib/MySQL to /data/MySQL

I had taken foll steps

stopped mysql
cp -rap /var/lib/MySQL /data/mysql
it copied successfully

I changed data dir path in vi/etc/my.cnf file

to /data/mysql
and also changed MySQL.sock file path to new path
/data/MySQL
restarted the MySQL server


I now am trying to login into MySQL server using MySQL -u root -p

after entering the password I gets error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

if I give the old path of data and socket file it works but new path not working


please help ?

TenTenths 08-31-2016 10:06 AM

If you change the socket in my.cnf you will need to have a corresponding [client] entry to tell the mysql client to use this socket.

Try adding this to the end of your my.cnf once you've made your changes:

Code:

[client]
socket=/the/new/path/to/mysql.sock


keefaz 08-31-2016 10:59 AM

Also make sure you changed ownership of /data/MySQL to the mysql user

edit: it's /data/mysql or /data/MySQL ?


All times are GMT -5. The time now is 10:44 PM.