Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't connect with socket /var/lib/mysql/mysql.sock

Status
Not open for further replies.

K1BBQ

Programmer
May 28, 2001
27
0
0
US
I'm a student, been working on a web-based database. Running RedHat 6.2, the Publisher's Version that came with the textbook, MySQL 3.22.32, everything was running fine. I upgraded to the boxed set RH 7.0, and foolishly allowed it to include the MySQL package. I did copy out the database to the WinC drive just in case, but now I can't connect in the terminal window. I get "Cant connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)". I find on the internet that lots of people seem to get this problem, and nowhere have I seen a fix that works for me. The file is there in /var/lib/mysql, and I found one also in /tmp. Both were 0 bytes, if that's meaningful. I hoped that mysql.com would have a copy of the file, if that's the fix, but no luck there. Maybe I should just nuke everything MySQL and reinstall from the original tar.gz I installed from at the beginning of the term at school? I know how to uninstall things in Windows, but am reluctant to do it in Linux just yet.

I also tried downloading the latest 3.23.38 rpm from mysql.com, and rpm'ed it, but that didn't help.

I'm afraid I'm just a student and this has got me skunked.

F.
 
locate mysql.sock

make a symbolic link to it from /var/lib/mysql

My problem was teh other way around. It was looking for it in /tmp but the .sock file was in /var/wherever

A symbolic link fixed it. Though, there is a place in the manual that tells you how to make the prog find it wherever it is. Search the manual for mysql.sock Steve Davis
hey.you@hahaha.com.au
 
Another tip: check the variable list with mysqladmin and the location of the my.cnf file.

HTH

seagull69
 
Steve -- can you tell me exactly how to do a link?

seagull69 -- the variable for the socket says /tmp/mysql.sock

Thank you, both

F
 
To create the link:
[tt]
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[/tt]

I hope it works...
Unix was made by and for smart people.
 
When I first installed RedHat 7.0 from start (this means wihout upgrading), even if I choosed mysql to start automatically, it wouldn't. If you choose something like that remember that the First time mysql starts after install, it has no users thus with no privileges in it.

And because the mysql server when starts automatically, starts as a user named "mysql" and there is no mysql user on the users database (because there are no users at all), system denies to this user to start the database connections.

But it was working if after the system was booted, you try to start it manually (of course with the -u root option).

You may also start it by skipping the privileges table, or may not let you get in and modify the 'mysql' database.


After I got in this way, and added first of all the root user, and then the "mysql" (!!) user(to allow the server start the connections with the mysql user, thus to start the server automatically with the system), Everything was working great!

That's my advice on this problem, and possibly (I hope) the solution to your problem:) ...

 
To solve this problem:

Edit or Create "/etc/my.cnf" and add or change these lines:

[client]
socket=path-for-socket-file

[mysqld]
socket=path-for-socket-file

FOR EXAMPLE:

[client]
socket=/tmp/mysql.sock

[mysqld]
socket=/tmp/mysql.sock


AND THAT'S IT!!!
 
I get this problems with the socket, could somebody tell me how I can solve it?

011109 17:04:38 mysqld started
011109 17:04:38 Can't start server : Bind on unix socket: Permission denied
011109 17:04:38 Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
011109 17:04:38 Aborting

011109 17:04:38 /usr/sbin/mysqld: Shutdown Complete

011109 17:04:38 mysqld ended
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top