MySQL Forums
Forum List  »  Install & Repo

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Posted by: Dennis Yu
Date: July 17, 2006 03:32AM

I use SuSE SLES9, it was included 4.0.18 but I removed all and installed 5.0.22 RPM.
When just completed RPM installation, there's no my.cnf in /etc, at this time, if MySQL started at boot time (thru /etc/init.d/mysql start), or manually thru mysqld_safe, it will create /var/lib/mysql/mysql.sock and /var/lib/mysql/sles9.pid (my server named sles9) files. If your use "mysqladmin -p shutdown" (I have password for root), you'll see these 2 files disappeared.
Then I copied /usr/share/mysql/my-large.cnf to /etc/my.cnf without any change of its content, use mysqld_safe restarted MySQL, server is started but there's no /var/lib/mysql/mysql.sock file. If I use TCP/IP connection (mysql -h 127.0.0.1 -u root -p) still can connect to local MySQL server. Later checked reference manual chapter 5, I stopped server, added [mysql.server] and [mysqld_safe] sections in my.cnf above [mysqld] section, put :
socket=/var/lib/mysql/mysql.sock
pid-file=/var/lib/mysql/sles9.pid
then everything become normal after restarted with mysqld_safe. My conclusion:
1) There're only 2 ways to start/stop MySQL server, "/etc/init.d/mysql start" and "mysqld_safe".
2) If want to pass variables to any of above, must put exactly in its section in my.cnf
3) MySQL started at host boot time, it uses "/etc/init.d/mysql start", if later stopped and restarted with "mysqld_safe", the sections [mysql.server] and [mysqld_safe] must contain same contents, otherwise will result differently.
4) carefully study reference manual chapter 5 is needed and greatly helped.



Edited 1 time(s). Last edit at 07/17/2006 07:07AM by Dennis Yu.

Options: ReplyQuote


Subject
Written By
Posted
January 08, 2009 02:01PM
Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
July 17, 2006 03:32AM
April 15, 2009 11:56AM
October 21, 2009 06:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.