mysql.sock missing, cannot stop mysqld

wwwwizard

New Member


Messages: 4

Cannot stop mysqld using
service mysqld stop
/etc/rc.d/init.d mysqld stop
or
mysqladmin -p shutdown

The latter gives me this:
Code:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
That file does not exist, nor does /tmp/mysql.sock.

The server is up and running just fine. but I cannot stop it or restart it.
 

gkontos

Daemon

Reaction score: 488
Messages: 2,160

FreeBSD is not Linux ;)

[CMD=""]# /usr/local/etc/rc.d/mysql-server stop[/CMD]

or

[CMD=""]# service mysql-server stop[/CMD]

Read the handbook on how to start / stop services.
 
OP
wwwwizard

wwwwizard

New Member


Messages: 4

Ha ha, yes, good point. But mysQLD behaves the same on both systems. I posted here because I had seen some very helpful advice on other MySQL issues.

Since the socket is missing, but the server is running, is there any way to restart MySQL from the SQL editor it self, or from with in the mysql program?
 
OP
wwwwizard

wwwwizard

New Member


Messages: 4

mysql manual says that a SIGHUP will cause the server to reload its privelege tables. It doesn't make mention of restarting the service itself.

Does anyone have any idea what would happen if I restarted the server with InnoDB tables running? Would MySQL shut down gracefully (given that it doesn't have a socket) or would it kill mysqld, corrupting the innodb tables?

Does anyone know how to start mysql from within the sql query editor, or how to restore the mysql.sock file? it seems that may be my only hope.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,358
Messages: 38,883

wwwwizard said:
Does anyone have any idea what would happen if I restarted the server with InnoDB tables running? Would MySQL shut down gracefully (given that it doesn't have a socket) or would it kill mysqld, corrupting the innodb tables?
As long as you don't kill -9 the MySQL process. A 'normal' kill should shutdown MySQL gracefully.
 

SocialHaze

Member

Reaction score: 4
Messages: 40

Verify the path to the sock file in my.cnf. Also verify if there is networking support. If there is, try to shutdown by connecting via TCP/IP, send MySQL a SIGHUP, try again, send MySQL a SIGQUIT, try again. If that fails try a SIGKILL.

SIGQUIT shuts down MySQL gracefully on my system, I don't have InnoDB tables, so I was able to try it out.
 

gkontos

Daemon

Reaction score: 488
Messages: 2,160

wwwwizard said:
Does anyone have any idea what would happen if I restarted the server with InnoDB tables running? Would MySQL shut down gracefully (given that it doesn't have a socket) or would it kill mysqld, corrupting the innodb tables?

If you properly restart mysql-server then you will not have any problems with your innodb tables.

[CMD=""]# service mysql-server restart[/CMD]

wwwwizard said:
Does anyone know how to start mysql from within the sql query editor, or how to restore the mysql.sock file? it seems that may be my only hope.

mysql.sock should be located under /tmp

However, I am not aware of a way to start or stop the server other than rc commands.
 

da1

Aspiring Daemon

Reaction score: 96
Messages: 885

gkontos said:
However, I am not aware of a way to start or stop the server other than rc commands.

kill works just fine. And with InnoDB, you should have no problems since they are designed to recover.
 
OP
wwwwizard

wwwwizard

New Member


Messages: 4

Thank you everyone for all your help. This is SOLVED.

I found another way which is not mentioned here (kill is probably the most direct, but this also works), and will record it for posterity:

SOLVED!

When you cannot connect via a socket you can still connect via TCP/IP. I went to another machine and used mysqladmin to connect to the host, and the shutdown command worked just fine.

In order to do this I had to grant root privileges to another machine's address, but that's easily revoked after the fact.

Hope this helps someone!

BTW - when it started back up it created the mysql.sock. At some point over the last 2 years, the old one must have been deleted.

Thanks again everybody. Glad to know a linux guy can still get some help from the FreeBSD crowd ;-)
 
Top