Start MySQL prompt: Can ' t connect to MySQL through socket '/tmp/mysql.sock '

Source: Internet
Author: User
Tags socket

The following error occurred while starting 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 the local MySQL server through socket '/tmp/mysql.sock ' (111) '
Check that mysqld are running and that the socket: '/tmp/mysql.sock ' exists!

Workaround:

The code is as follows Copy Code

[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's parameter description:

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

List Common parameters:

-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.


Another solution


I modified the value of the socket below the [mysqld] option through VIM/ETC/MY.CNF

The code is as follows Copy Code
Socket=/var/lib/mysql/mysql.sock

Ok,mysqld can be activated.

Next, the MySQL boot is not, again, VIM/ETC/MY.CNF, added the following script:

[MySQL]

The code is as follows Copy Code
Socket=/var/lib/mysql/mysql.sock

Then, mysqladmin not start, or the same, under [mysqladmin] The socket value is set to the same path
OK, it's ready to start.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.