In linux, mysql cannot be remotely accessed or accessed locally.

Source: Internet
Author: User
In terms of servers in the company, sometimes there is a small problem during the holiday. You need to access the database, but you cannot connect it with graphic tools, after that, you can remotely log on to the linux server where mysql is located and cannot log on normally, but you can use it on the company's computer (this problem is still unknown, it is strange, or do you know too little about it?

In terms of servers in the company, sometimes there is a small problem during the holiday. You need to access the database, but you cannot connect it with graphic tools, after that, you can remotely log on to the linux server where mysql is located and cannot log on normally, but you can use it on the company's computer (this problem is still unknown, it is strange, or do you know too little about it?

In terms of servers in the company, sometimes there is a small problem during the holiday. You need to access the database, but you cannot connect it with graphic tools, after that, you can remotely log on to the linux server where mysql is located and cannot log on normally, but you can use it on the company's computer (this problem is still unknown, it is strange, I know too little about it myself !), Today I encountered this problem again. Record the solution.


Go to linux and log on to mysql. The following occurs:

[Root @ streeteast ~] # Mysql-uroot-p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock' (2)


Try to restart the mysql service in the following situations:

[Root @ streeteast ~] # Service mysql stop
MySQL server PID file cocould not be found! [FAILED]


Speechless!

I searched the information and said that the mysql process was locked. Therefore, run the top command to check whether the USER is a mysql process sometimes. Check its PID and kill it, then execute the service mysql start command, and find out the cause.

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.