解决Can’t connect to MySQL through socket ‘/tmp/mysql.sock’

启动MYSQL是出现以下错误:

[root@www ~]# /usr/local/webserver/mysql/bin/mysqladmin -u root -p 12345678
Enter password:
/usr/local/webserver/mysql/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (111)’
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!

解决方法:

[root@www ~]# /usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.38-log Source distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

mysql的参数说明:

/usr/local/webserver/mysql/bin/mysql –help | less

列举常用参数:

-u, –user=name     User for login if not current user.
-p, –password[=name]
                      Password to use when connecting to server. If password is
                      not given it’s asked from the tty.
-S, –socket=name   Socket file to use for connection.

it’s ok !




posted @ 2013-08-15 16:38  小名辉辉  阅读(544)  评论(0编辑  收藏  举报