linux correctly restarts the MySQL method

  • 2020-06-01 11:11:46
  • OfStack

Since Mysql is installed from the source package, there is no red hat common servcie mysqld restart script on the system
Had to restart it manually.
Someone suggested Killall mysql. This barbaric method is actually no good, forced termination, if the table is damaged, the loss is huge.
A secure restart method is recommended here
$mysql_dir/bin/mysqladmin -u root -p shutdown
$mysql_dir/bin/safe_mysqld &
mysqladmin and mysqld_safe are located in the bin directory of the Mysql installation directory and are easy to find.

Restart the MySQL service under windows

Start and stop the mysql service for users without mysql graphics management:
... \... \ bin > net stop mysql
... \... \ bin > net start mysql

How do I start/stop/restart MySQL

Start, stop and restart MySQL is a necessary operation for every webmaster who owns an independent host. The following is a simple introduction to the following operation methods:

1. Startup mode

1. Start with service: service mysqld start
2, start using mysqld script: / etc/inint d/mysqld start
3. Start with safe_mysqld: safe_mysqld &

2. Stop

1. Start with service: service mysqld stop
2, start using mysqld script: / etc/inint d/mysqld stop
3, mysqladmin shutdown

3. Restart
1. Start with service: service mysqld restart
2, start using mysqld script: / etc/inint d/mysqld restart

I haven't rebooted mysql under linux for a long time, it seems that the service is running too stably. Oh, the machine died recently, and the mysql service has to be rebooted after rebooting. I forgot the command, so I have to baidu and google!

Search from the Internet below, should be the most reliable, we try to use not!

I haven't been messing around with the server for a long time. When I opened the page for debugging early on, I found that the /tmp directory space was full, resulting in the failure of MySQL to run normally. Therefore, I modified the storage path of my.sock in my.cnf and the relevant Settings in php.ini. At this time, I need to restart MySQL

As a result, baidu and google have adopted the "restart MySQL command under Linux", and the search result 1 shows that the answer has been found in the previous summary information:

1. MySQL installed through the rpm package

service mysqld restart

2, from the source package installed MySQL

// linux close MySQL command
$mysql_dir/bin/mysqladmin -uroot -p shutdown
// linux starts the command MySQL
$mysql_dir/bin/mysqld_safe &

mysql_dir is the installation directory of MySQL, mysqladmin and mysqld_safe are located in the bin directory of MySQL installation directory, which is easy to find.

3. When all the above methods are invalid, you can shut down MySQL by forcibly ordering: "killall mysql". However, it is not recommended to use this method, because this barbaric method will forcibly terminate MySQL database service, which may cause table corruption... So weigh it up.

Conclusion: it is a long time since I have been playing around with the server. I have forgotten many basic commands

Related articles: