How to start/stop/restart MySQL
First, the way to start
1, use service to start: Service mysqld start
2. Start with mysqld script:/etc/inint.d/mysqld start
3. Use Safe_mysqld to start:safe_mysqld&
Second, stop
1, use service to start: Service mysqld stop
2. Start with mysqld script:/etc/inint.d/mysqld stop
3, mysqladmin shutdown
Third, restart
1, use service to start: Service mysqld restart
2. Start with mysqld script:/etc/inint.d/mysqld restart
When you first started to learn MySQL, it was redhat with your own. What's the boot/rc.d/init.d/start
This is simple, but later the more learned, the system itself with MySQL, some version is too low, some with
I want to install the low version of MySQL required for the Web service
Later I learned to install MySQL in the way of tar, and my MySQL was installed in the/usr/local/mysql directory.
Have encountered many problems. The most common are:
ERROR 2002:can ' t connect to the local MySQL server through socket
'/tmp/mysql.sock ' (111)
Solution:
[Root@test mysql]#/usr/local/mysql/bin/mysqladmin-u root/
>-s/var/lib/mysql/mysql.sock password ' your.passwd '
or make a connection.
Ln-s/var/lib/mysql/mysql.sock/tmp
In fact, the hint can not find/tmp/mysql.sock sometimes not in/tmp directory does not have this file, is started
The orders are wrong, I've met
Common several startup ways that themselves are not remember very clearly if you're sure TMP under there are mysql.sock this
File, try a few 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 that safe_mysqld and Mysqld_safe are different,& that MySQL is running in the background) mine will have an error.
Stopping server from PID file
/usr/local/mysql/data/localhost.localdomain.pid
060304 11:46:21 Mysqld Ended
This is a permissions issue, my MySQL directory belongs to root users, but also belong to the root group, the use of Mysqld_safe boot is no problem,
Everybody just pay attention to these few mysql,safe_mysqld,mysqld_safe,mysqld,mysqladmin. Try a few more times
In fact, sometimes MySQL has been started, to see whether the MySQL start command
Ps-aux | grep mysqld
will see the following similar content
MySQL 6394 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
MySQL 6395 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
MySQL 6396 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
Root 6422 0.0 1.1 2408 732 PTS/3 S 16:20 0:00 grep
Mysql
See if MySQL is listening on port command
Netstat-tl | grep MySQL
will see the following similar content
TCP 0 0 *:mysql *:* LISTEN
The above Linux start/restart/stop MySQL command (detailed) is a small set to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.