How to start/stop/restart Mysql database in Linux

1. View mysql version
Method 1: status;
Method 2: select version();

2. Mysql start, stop and restart common commands
a. Start method
1. Use service to start:
[root@localhost /]# service mysqld start (5.0 version is mysqld)
[root@szxdb etc]# service mysql start (5.5.7 version is mysql)

2. Start using the mysqld script:
/etc/inint.d/mysqld start

3. Start with safe_mysqld:
safe_mysqld&

b. Stop
1. Use service to start:
service mysqld stop

2. Start using the mysqld script:
/etc/inint.d/mysqld stop

3、mysqladmin shutdown

c. Restart
1. Start with service:
service mysqld restart service mysql restart (command in version 5.5.7) 

2. Start using the mysqld script:
/etc/init.d/mysqld restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326537708&siteId=291194637