HowTo SSH Restart Mysql Server on a Linux and Unix Command Line

I‘m using a CentOS, RHEL, Fedora Linux server. I want to restart my mysqld server after making some changes to my.cnf file. How do I restart mysql server from a command line on a Linux or Unix-like systems?

The syntax is as follows to start, stop, or restart the mysql server on a Linux or Unix-like systems. [donotprint]
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 1m
[/donotprint]You must run the following command as per your Linux/Unix variant. You must be the root user to run the following commands.

CentOS/RHEL/Fedora/Scientific Linux version 4.x/5.x/6.x or older users

The syntax is:

### To start ###
service mysqld start
# OR
/etc/init.d/mysqld start
 
### To stop ###
service mysqld stop
# OR
/etc/init.d/mysqld stop
 
### To restart ###
service mysqld restart
# OR
/etc/init.d/mysqld restart

CentOS/RHEL/Fedora/Scientific Linux version 7.x or newer users

The syntax is as follows to start mariadb/mysql server:

##  mariadb ##
systemctl start mariadb
## mysql 
systemctl start mysqld

The syntax is as follows to stop mariadb/mysql server:

##  mariadb ##
systemctl stop mariadb
## mysql 
systemctl stop mysqld

The syntax is as follows to restart mariadb/mysql server:

##  mariadb ##
systemctl restart mariadb
## mysql 
systemctl restart mysqld

Debian/Ubuntu Linux users

The syntax is as follows to start/stop/restart mysql server:

#### To start ####
/etc/init.d/mysql start
# OR
service mysql start
 
#### To stop ####
/etc/init.d/mysql stop
# OR
service mysql stop
 
#### To restart ####
/etc/init.d/mysql restart
# OR
service mysql restart

FreeBSD Unix server user

To start the Mysql server type:

# /usr/local/etc/rc.d/mysql-server start

To restart the Mysql server type:

# /usr/local/etc/rc.d/mysql-server restart

To stop the Mysql server type:

# /usr/local/etc/rc.d/mysql-server stop

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • anRoswell Jan 14, 2017 @ 15:31

    Excelente me funciono el comando tal cual, muchas gracias.

  • Lava Jul 18, 2020 @ 7:29

    Really useful post

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum