How to start/stop/restart MySQL
I. Startup Mode
1. Start with service: Service mysqld
Start
2. Use the mysqld script to start:/etc/inint. d/mysqld start
3. Use
Start safe_mysqld: safe_mysqld &
Ii. Stop
1. Use Service
Start: 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 mysqld
Script startup:/etc/inint. d/mysqld restart
Question editing Abstract
How to start/stop/restart MySQL
I,
Startup Mode
1. Start with service: Service mysqld start
2. Use mysqld
Script startup:/etc/inint. d/mysqld start
3. Use safe_mysqld
Start: 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
Learning at the beginning
MySQL comes with RedHat. What is startup/rc. d/init. d/start
This is simple, but the more you learn, the more
In MySQL, some versions are too low, some are
The earlier MySQL version required for the Web service that you want to install
Later, I learned how to install it in tar.
MySQL, Which is enabled in the/usr/local/MySQL directory
I have encountered many problems. The most common is:
Error
2002: Can't connect to local MySQL server through socket
'/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 prompt is not found.
/Tmp/MySQL. Sock sometimes does not have this file in the/tmp directory, it is started
The command is incorrect. I have encountered
There are several common startup methods that you don't remember very well.
If you are sure that mysql. Sock exists in 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 & (note
Safe_mysqld is different from mysqld_safe. & it indicates that MySQL runs in the background.) I will report an error.
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.
Mysqld_safe is enabled,
You only need to pay attention to these
MySQL, safe_mysqld, mysqld_safe, mysqld, mysqladmin. Multiple trials
Times
In fact, sometimes MySQL has been
Usually started. Check whether MySQL has started the command.
PS-Aux | grep mysqld
You will see the following similar content
For MySQL 6394
0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
For MySQL 6395
0.0 1.5 10528 992 pts/3 S
/Usr/local/MySQL/
For 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 in monitoring
Listen to the PORT command
Netstat-Tl | grep MySQL
You will see the following similar content
TCP 0 0 *: MySQL *:*
Listen