Start,Restart or Stop MySQL Server

ps -ef|grep mysql —-(to get or check mysql server status or socket path)

mysql -u root -p –socket=’/var/mysql/mysql.sock’

Method-1(Recommended) To restart, start or stop MySQL server from the command line
———————————————————————————–
/etc/init.d/mysqld status

/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
Method-2 Some Linux flavours offer the service command to
———————————————————
chkconfig mysqld on

service mysqld start

service mysqld stop

service mysqld restart
(OR)
——————–

service mysql start

service mysql stop

service mysql restart
(OR) Method-4 and (Last Method if above doesnt work) Running and Shutting down MySQL Server:
————————————————————————————–

First check if your MySQL server is running or not.

ps -ef | grep mysqld

If your MySql is running, then you will see mysqld process listed out in your result.
If server is not running, then you can start it by using the following command:

root@host# cd /usr/bin
./safe_mysqld &

Now, if you want to shut down an already running MySQL server, then you can do it by using the following command:

root@host# cd /usr/bin
./mysqladmin -u root -p shutdown
Enter password: ******

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: