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