MySQL is running but PID file is not found

Source: Internet
Author: User
Tags vps

Today, VPS access is slow. I restarted lnmp with the/root/lnmp restart command. After the restart, I found that MySQL cannot be connected. Running Service MySQL restrat in SSH causes the MySQL is running but PID file cocould not be found error.

The "can't connect to MySQL through socket mysql. Sock" error occurs when MySQL-u root-p command is used to run MySQL.

I will find a good article on the internet, MySQL PID file not found and can't connect to MySQL through socket MySQL. sock, although I directly restarted VPS (reboot) to solve this problem, many of the content above is quite useful.

 

Record several previously unknown knowledge:

1. grep is a search command that can be used to search strings in a file, such as PS aux | grep MySQL.

2. The ps command shows that all processes are similar to the tasklist command in Windows. The aux command shows the itinerary of all other users. For example, after running the PS aux | grep MySQL command, you can find

-Datadir =/usr/local/MySQL/var-PID-file =/usr/local/MySQL/var/li220-124.pid

3. Kill-9 [pid] command to terminate a process find the process PID through PS and then terminate the process with kill-9 [pid] (-9 indicates that the process is forced to stop immediately)

4. the hostname command displays the current host name uname-a command displays the current system kernel version

5. Service commands

You can view the MySQL status through service MySQL status. But how do I find other service names?

You can find the service names in the LS/etc/init. d/directory.

6. Run the TOP command to view memory and CPU usage

<SHIFT + m sort by memory usage>

<1 Display CPU usage>

7. chown change owner and owner Group

Chown [Option]… [Owner] [: [group] File...

For example, chown MYSQL: MySQL RedHat. PID changes the ownner of RedHat. PID to MySQL

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.