📜  opensuse 停止 MySQL (1)

📅  最后修改于: 2023-12-03 15:03:23.199000             🧑  作者: Mango

Stop MySQL in openSUSE

MySQL is a popular open-source relational database management system used by many developers and organizations. In openSUSE, you may need to stop MySQL for various reasons, such as performing maintenance or troubleshooting issues.

Method 1: Using systemd

openSUSE uses systemd to manage system services, including MySQL. You can use the following commands to stop MySQL:

sudo systemctl stop mysql.service

This will stop the MySQL service immediately. You can also use the status command to check the status of the MySQL service:

sudo systemctl status mysql.service

This will show you whether the service is running or stopped.

Method 2: Using the mysqld_safe script

Alternatively, you can stop MySQL by running the mysqld_safe script, which is included with MySQL. This is useful if you need to stop MySQL manually or if you do not have root access.

First, open a terminal and navigate to the MySQL installation directory. On openSUSE, this is usually /usr/bin or /usr/sbin. Then, run the following command:

sudo ./mysqld_safe --pid-file=/var/run/mysql/mysql.pid --datadir=/var/lib/mysql --socket=/var/run/mysql/mysql.sock --user=mysql --log-error=/var/log/mysql/mysql.log --ledir=/usr/share/mysql

This will start the mysqld_safe script and stop the MySQL service.

Conclusion

Stopping MySQL in openSUSE is easy and can be done using either systemd or the mysqld_safe script. If you are unsure which method to use, we recommend using systemd as it is the standard way of managing services in openSUSE.