LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-30-2016, 06:19 PM   #1
tushar.jadhav29
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
/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 ?
 
Old 08-31-2016, 11:06 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,171

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
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
 
1 members found this post helpful.
Old 08-31-2016, 11:59 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
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 12:01 PM.
 
  


Reply


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 02:16 PM
MySQL missing socket issue when only mysql-client installed andrewdazotus Linux - Server 1 09-13-2013 03:06 PM
how to fix this issue about squid??? oscareee888 Linux - Server 4 09-23-2011 10:39 AM
Apache2, PHP5, or MYSQL issue: Unable to jump to row 0 on MySQL ..... MTAS Linux - Server 5 03-26-2010 10:13 AM
mysql down...can't find a fix after several hours :( I_AM Linux - General 1 03-02-2005 09:34 PM


All times are GMT -5. The time now is 07:43 PM.

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