Starting and Stopping MySQL on Unix
MySQL runs as the user mysql
abd the server process is called mysqld.
joseph@ubuntu:~$ ps ax | grep mysqld
4477 pts/4 S+ 0:00 grep --color=auto mysqld
31065 ? Ssl 0:01 /usr/sbin/mysqld
when using binary installations MySQL can be started and stopped with the startup scripts in /etc/init.d
Start MySQL
joseph@ubuntu:~$ sudo service mysql start
Stopping MySQL
joseph@ubuntu:~$ sudo service mysql stop
or using the mysqladmin shutdown
joseph@ubuntu:~$ mysqladmin -u joseph -p shutdown
Check Status
joseph@ubuntu:~$ sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2016-08-12 07:34:18 CAT; 35s ago
Process: 5110 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 5105 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 5109 (mysqld)
Tasks: 28 (limit: 512)
CGroup: /system.slice/mysql.service
└─5109 /usr/sbin/mysqld
Aug 12 07:34:17 ubuntu systemd[1]: Starting MySQL Community Server...
Aug 12 07:34:18 ubuntu systemd[1]: Started MySQL Community Server.