Linux 下如何啟動 停止 重啟MySQL

2021-06-22 04:17:47 字數 1416 閱讀 7689

linux 下如何啟動/停止/重啟mysql

一、啟動方式

1、使用 service 啟動:service mysqld start

2、使用 mysqld 指令碼啟動:/etc/inint.d/mysqld start

3、使用 safe_mysqld 啟動:safe_mysqld&

二、停止

1、使用 service 啟動:service mysqld stop

2、使用 mysqld 指令碼啟動:/etc/inint.d/mysqld stop

3、 mysqladmin shutdown

三、重啟

1、使用 service 啟動:service mysqld restart

2、使用 mysqld 指令碼啟動:/etc/inint.d/mysqld restart

檢視mysql是否在監聽埠命令

netstat -nlp | grep mysql

tcp        0      0 0.0.0.0:3660                0.0.0.0:*                   listen      16314/mysqld

1。 改表法。

可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在localhost的那台電腦,登入mysql後,更改 "mysql" 資料庫裡的 "user" 表裡的 "host" 項,從"localhost"改稱"%"

mysql -u root -pvmwaremysql>use mysql;

mysql>update user set host = '%' where user = 'root';

mysql>select host, user from user;

實際操作中, update 報錯。

mysql> update user set host = '%' where user = 'root';

error 1062 (23000): duplicate entry '%-root' for key 'primary'

2. 授權法。

例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。

mysql>grant all privileges on *.* to 'myuser'@'%' identified by 'mypassword' with grant option;

mysql>grant all privileges on *.* to 'myuser'@'localhost' identified by 'mypassword' with grant option;

mysql>flush   privileges;

這個方法 ok!

Linux 下mysql 啟動 停止 重啟

linux下開啟 關閉 重啟mysql服務命令 一 啟動 1 使用 service 啟動 service mysql start 2 使用 mysqld 指令碼啟動 etc inint.d mysql start 3 使用 safe mysqld 啟動 safe mysql 二 停止 1 使用 se...

如何 ubuntu下啟動 停止 重啟MySQL

如何啟動 停止 重啟mysql 一 啟動方式 1 使用 service 啟動 service mysql start 2 使用 mysqld 指令碼啟動 etc inint.d mysql start 3 使用 safe mysqld 啟動 safe mysql 二 停止 1 使用 service ...

linux 下 apache啟動 停止 重啟命令

基本的操作方法 本文假設你的apahce安裝目錄為 usr local apache2,這些方法適合任何情況 apahce啟動命令 推薦 usr local apache2 bin apachectl start apaceh啟動 apache停止命令 usr local apache2 bin a...