How to start/stop mysql server on Ubuntu?

13 10 2010

Its really simple, just open the terminal and give the command below to start mysql server –
sudo /etc/init.d/mysql start

To restart mysql server, use the command –
sudo /etc/init.d/mysql restart

You can stop mysql server by simply the command –
sudo /etc/init.d/mysql stop

If your mysql server isn’t running and you attempt to connect to the mysql server, you may get a warning like this –

Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/run/mysqld/mysqld.sock) in /home/atik/www/***.php on line ***

In that case, just start the mysql server.

Advertisements