Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-30-2016, 05:19 PM   #1
LQ Newbie
Registered: Apr 2016
Posts: 11
Blog Entries: 1

Rep: Reputation: Disabled
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
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 ?
Old 08-31-2016, 10:06 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,487

Rep: Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907
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:

1 members found this post helpful.
Old 08-31-2016, 10:59 AM   #3
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,390

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
Also make sure you changed ownership of /data/MySQL to the mysql user

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

Last edited by keefaz; 08-31-2016 at 11:01 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL server version differs from MySQL client version -- should I fix this? sneakyimp Linux - Server 2 06-27-2014 01:16 PM
MySQL missing socket issue when only mysql-client installed andrewdazotus Linux - Server 1 09-13-2013 02:06 PM
how to fix this issue about squid??? oscareee888 Linux - Server 4 09-23-2011 09:39 AM
Apache2, PHP5, or MYSQL issue: Unable to jump to row 0 on MySQL ..... MTAS Linux - Server 5 03-26-2010 09:13 AM
mysql down...can't find a fix after several hours :( I_AM Linux - General 1 03-02-2005 08:34 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration