I. Startup Mode
1. Start with service: Service mysqld start
2. Use the mysqld script to start:/etc/init. d/MySQL start
3. Start with safe_mysqld: safe_mysqld &
Ii. Stop
1. Start with service: Service mysqld stop
2. Use the mysqld script to start:/etc/inint. d/mysqld stop
3. mysqladmin Shutdown
3. Restart
1. Start with service: Service mysqld restart
2. Use the mysqld script to start:/etc/inint. d/mysqld restart
I have encountered many problems. The most common is:
Error 2002: Can't connect to local MySQL Server throughsocket
'/Tmp/MySQL. Sock' (111)
Solution:
[Root @ test MySQL] #/usr/local/MySQL/bin/mysqladmin-u root/
>-S/var/lib/MySQL. Sock password 'your. passwd'
Or make a connection.
Ln-S/var/lib/MySQL. Sock/tmp
In fact, the error message "/tmp/MySQL. Sock" is not found in the/tmp directory.
The command is incorrect. I have encountered
Several Common Startup methods are not clearly remembered. If you are sure that mysql. Sock is available under TMP
File. Try other commands.
/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 &
Stopping server from PID File
/Usr/local/MySQL/data/localhost. localdomain. PID
060304 11:46:21 mysqld ended
This is a permission issue. My MySQL directory belongs to the root user and also belongs to the root group. You can use mysqld_safe to start MySQL,
You only need to pay attention to these MySQL, safe_mysqld, mysqld_safe, mysqld, and mysqladmin. Try multiple times.
Times
In fact, sometimes MySQL has started normally and check whether MySQL has started the command.
PS-Aux | grep mysqld
You will see the following similar content
MySQL 6394 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
MySQL 6395 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
MySQL 6396 0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
Root 6422 0.0 1.1 2408 732 pts/3 s grep
MySQL
Check whether MySQL is listening for port commands
Netstat-Tl | grep MySQL
You will see the following similar content
TCP 0 0 *: MySQL *: * listen