When mysql is started, the following solution is displayed:/tmp/mysql. sock does not exist. mysqlmysql. sock
When mysql is started, the following solution is displayed:/tmp/mysql. sock does not exist.
Troubleshooting when mysql is started (mysql 5.0.45 redhat as43) ========================================================== =========================== solve the problem returned when mysql is started (mysql 5.0.45 redhat as 43) author: lawzjf (http://lawzjf.itpub.net) published in: 2008.01.13 0classification: small penguin Source: http://lawzjf.itpub.net/post/417/451262 --------------------------------------------------------------- start mysql error:
Starting mysqld daemon with databases from/var/lib/mysqlSTOPPING server from pid file/var/run/mysqld. pid071112 00:22:06 mysqld ended view log: # less/var/log/mysqld. the log contains the following sections:
071112 0:22:06 [ERROR]/usr/local/mysql/bin/mysqld: Can 'tcreate/write to file'/var/run/mysqld. pid '(Errcode: 2) 071112 0:22:06 [ERROR] Can't start server: can't create PIDfile: no such file or directory071112 00:22:06 mysqld ended # cd/var/run/# ls
The mysqld directory does not exist. Create it:
# Mkdir/var/run/mysqld # cd/var/run/mysqld
Create the mysqld. pid file:
# Touch mysqld. pid # cd .. # chown-R mysql mysqld. # cd/usr/local/mysql/# bin/mysqld_safe -- user = mysql & nohup: ignoring input and redirecting stderr to stdoutStarting mysqld daemon with databases from/var/lib/mysql can be started normally # bin/mysqladmin-u root password root error again [root @ localhost mysql] # bin /mysqladmin-u root passwordrootbin/mysqladmin: connect to server at 'localhost' failederror: 'Can't connect to local MyS QL server through socket '/tmp/mysql. sock' (2) 'check that mysqld is running and that the socket: '/tmp/mysql. sock' exists! [Root @ localhost mysql] # bin/mysql-u root-pEnter password: ERROR 2002 (HY000): Can't connect to local MySQL serverthrough socket '/tmp/mysql. sock '(2) Analysis:/tmp/mysql. sock does not exist
# Cd/var/lib/mysql/because the default mysql. sock of mysql is in/var/lib/mysql. sock, create a symbolic connection:
# Ln-s/var/lib/mysql. sock/tmp/mysql. sock # bin/mysql-u rootWelcome to the MySQL monitor. commands end with; or g. your MySQL connection id is 1 Server version: 5.0.45 MySQL Community Server (GPL) Type 'help; 'or 'H' for help. type 'C' to clear thebuffer. mysql> modify the root password
# Cd/usr/local/mysql/# bin/mysqladmin-u root-p password yourpassword everything is OK.