To restart, start or stop MySQL or mariadb database servers from the command line, type the following at the shell prompt…
On Linux start/stop/restart from the command line:
/etc/init.d/mysqld start /etc/init.d/mysqld stop /etc/init.d/mysqld restartSome Linux flavors offer the service command too
service mysqld start service mysqld stop service mysqld restartor
service mysql start service mysql stop service mysql restartOn macOS Big Sur, Sierra & OSX to start/stop/restart MySQL post 5.7 from the command line:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plistsudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plistOn OS X to start/stop/restart MySQL pre 5.7 from the command line:
sudo /usr/local/mysql/support-files/mysql.server start sudo /usr/local/mysql/support-files/mysql.server stop sudo /usr/local/mysql/support-files/mysql.server restartUse the STA command to stop or restart the MySQL server. You may need to do this during database management activities.
Stop the MySQL Server
Restart the MySQL Server
Stop the MySQL Server
Stop the MySQL database server when performing database management activities in which the MySQL server is running, but the rest of the STA application is not.
IMPORTANT: Do not stop the MySQL server if the rest of the STA application is running.
Open a terminal session on the STA server, and log in as the Oracle user.
Stop the MySQL server:
$ STA stop mysqlVerify the server is not running:
$ STA status mysqlYou should see:
mysql is shutdown
Restart the MySQL Server
Restart the MySQL database server when performing database management activities in which you must shut down the STA application and then restart just the MySQL server.
Open a terminal session on the STA server, and log in as the Oracle user.
Start the MySQL service:
$ STA start mysqlVerify the server is running:
$ STA status mysqlYou should see:
mysql is running
This section covers the following topics:
To Set Up MySQL
To Start or Stop MySQL
To Set Up MySQL
You need to perform these steps only if you are using Solaris or Linux platforms.
Create a MySQL user account.
Refer to your operating system manual for instructions on how to create a user account. It is recommended that you create an operating system user account called mysql and group called dba for performing MySQL operations. Ensure that install-dir/mysql and its subdirectories including the data directory are owned by this user account.
Initialize the grant tables.
On Solaris, at the command prompt, you can use the following commands to initialize grant tables:
cd install-dir/mysql.
sh scripts/mysql_install_db --no-defaults --basedir=install-dir/mysql --datadir=install-dir/mysql/data
See //dev.mysql.com/doc/refman/5.0/en/index.html for detailed post-installation instructions for setting up MySQL.
To Start or Stop MySQL
Before You BeginOn Solaris, Linux, or Mac OS, ensure that you have completed the steps at To Set Up MySQL. Ensure that you read this option file and change values as appropriate and as documented at //www.mysql.com, prior to server startup.
To start MySQL:
On Solaris, Linux, or Mac OS, use the following command: Start: ./bin/mysqld_safe --defaults-file=install-dir/mysql/mysql.ini --user=user
On Windows, you can do one of the following:
Click Programs > Sun Microsystems > Sun Java SystemApplication Server 9.1 Update 1 with MySQL Community Server > Start MySQL 5.0 Database.
If you created a Windows service, start the ASMySQL service through the Control Panel.
To stop MySQL:
On Solaris, Linux, or Mac OS, use the following command: Stop: bin/mysqladmin -u root shutdown -p
On Windows, you can do one of the following:
Click Programs > Sun Microsystems > Sun Java SystemApplication Server 9.1 Update 1 with MySQL Community Server > Stop MySQL 5.0 Database.
If you created a Windows service, stop the ASMySQL service through the Control Panel.