Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Can't connect to local MySQL through socket & # 39 inceptive TMP Universe mysql.sockcharts

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Error message:

ERROR 2002: Can't connect to local MySQL server through socket'/ tmp/mysql.sock'

Solution:

/ usr/local/mysql/bin/mysqladmin-u root >-S / var/lib/mysql/mysql.sock password 'your.passwd'

Or make a soft connection.

Ln-s / var/lib/mysql/mysql.sock / tmp

Reason:

In fact, the prompt can not find / tmp/mysql.sock sometimes is not / tmp directory does not have this file, is the startup command is wrong.

/ usr/local/mysql/bin/mysql-u root-p/usr/local/mysql/bin/mysqld-- user=mysql&/usr/local/mysql/bin/mysqld-- user=root&/usr/local/mysql/bin/mysqld_safe-- user=root&/usr/local/mysql/bin/mysqld_safe-- user=mysql&/usr/local/mysql/bin/safe_mysqld--uer=root& (note that safe_mysqld is different from mysqld_safe, & indicates that mysql is running in the background)

Error message:

STOPPING server from pid file / usr/local/mysql/data/localhost.localdomain.pid 060304 11:46:21 mysqld ended

Solution:

This is a question of permissions. My mysql directory belongs to root users and also belongs to the root group. It is no problem to start with mysqld_safe. Just pay attention to these mysql,safe_mysqld,mysqld_safe,mysqld,mysqladmin. Try a few more times. In fact, sometimes mysql has started normally. Check to see if mysql starts the command.

Ps-aux | grep mysqld

You will see something similar to the following

Mysql 6394 0.0 1.5 10528 992 pts/3 S 16:16 0:00/usr/local/mysql/mysql 6395 0.0 1.5 10528 992 pts/3 S 16:16 0:00/usr/local/mysql/mysql 6396 0.0 1.5 10528 992 pts/3 S 16:16 0:00/usr/local/mysql/root 6422 0.0 1.1 2408 732 pts/3 S 16:20 0:00 grep mysql

Check to see if mysql is listening for port commands

Netstat-tl | grep mysql

You will see something similar to the following

Tcp 0 0 *: mysql *: * LISTEN

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report