stop, start, or restart mysql

RESTART MYSQL ON REDHAT, FEDORA, CENT OS

#start
/etc/init.d/mysqld start 

#stop
/etc/init.d/mysqld stop 

#restart
/etc/init.d/mysqld restart 

 alternatively

 

#start
service mysqld start 

#stop
service mysqld stop 

#restart
service mysqld restart

 

RESTART MYSQL ON DEBIAN/UBUNTU

 

#start
/etc/init.d/mysql start 

#stop
/etc/init.d/mysql stop 

#restart
/etc/init.d/mysql restart 

If you've installed mysql using the native mysql package for mac, then you can start/restart mysql using the following commands. If you encounter issues starting it see below.

 

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start

 

Stop MySQL

sudo /usr/local/mysql/support-files/mysql.server stop

 

Restart MySQL

sudo /usr/local/mysql/support-files/mysql.server restart

 

Troubleshooting

At times your server may stop for whatever. You may encounter issues restarting it.

 

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 102

 

ERROR! MySQL server PID file could not be found!

 

ERROR! The server quit without updating PID file (/usr/local/mysql/data/HOMC02TG2DSGTDY.local.pid).

 

In this case we may need to kill any running mysql processes.

#to find the process
ps -e | grep mysql

#to kill
kill <<THE_PROCESS_NUMBER_ID>>

 

Cookbook Category: