Linux MySql狀態、啓動、中止、重啓命令

1.查看mysql狀態mysql

【1】ps -ef|grep mysqld 看看是否有mysqld_safe 和mysqld進程sql

  [root@localhost ~]# ps -ef|grep mysqld
  顯示結果:dom

  1)root 4052 29869 0 10:25 pts/0 00:00:00 grep mysqld
  2)root 30905 1 0 10:14 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
  3)mysql 31231 30905 1 10:14 pts/0 00:00:09 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-                      error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --socket=/tmp/mysqld.sock --port=3306                                    
【2】若是已添加到系統服務中,能夠service mysqld status
  [root@localhost ~]# service mysqld status
  顯示結果:
  SUCCESS! MySQL running (31231)socket

2.啓動MySQL服務spa

/etc/init.d/mysqld startrest

也能夠用/etc/init.d/mysqld的簡化命令啓動MySQL服務:service mysqld start進程

3.中止MySQL服務it

/etc/init.d/mysqld stopsed

也可使用服務命令:service mysqld stopfile

4.重啓MySQL服務

/etc/init.d/mysqld restart

 也可使用服務命令:service mysqld restart

相關文章
相關標籤/搜索