自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Ubuntu Server中LAMP下MySQL無法遠程連接問題1130

運維 系統(tǒng)運維
Ubuntu server中,LAMP的配置時,我們常常會遇到MYSQL無法遠程連接的問題。本文講述的是:“10061Can not connect to mysql error 10061”,“1130is not allowed to connect to this MySQL server1130”這兩個問題的解決。第二個問題:

Ubuntu Server中LAMPMySQL無法遠程連接該怎么辦:

MySQL無法遠程連接問題10061問題1130 

  很常見的問題發(fā)生了,我們怎么處理它?

  環(huán)境:ubuntu Server (版本8.04以上對于LAMP應(yīng)用都大同小異), cl@ubuntu.

  目的:安裝LAMP重新配置RT系統(tǒng)。

  軟件:服務(wù)器端已安裝LAMP組件,MySQL5.1版本;客戶端使用Navicat進行遠程連接。

  問題② 提示”is not allowed to connect to this MySQL server” ,如圖2  

LAMP/MySQL/遠程連接

 

  對于數(shù)據(jù)庫的遠程連接不外乎兩方面入手:1、客戶端至服務(wù)器端的連通性。2、服務(wù)器端沒有合理配置。當(dāng)然非要加上客戶端也沒有配置之類的,也尚可,比如ODBC的方式連接MySQL。

 ?、诋?dāng)MySQL 連接服務(wù)器時發(fā)生”is not allowed to connect to this MySQL server”錯誤,我們要注意在MySQL的user表中修改host列的localhost為%,即可以遠程連接。

  做如下操作:

  mysql> use mysql --切換數(shù)據(jù)庫上下文

  Reading table information for completion of table and column names

  You can turn off this feature to get a quicker startup with -A

  Database changed

  mysql> select host,user,password from user; --查詢USER 表

  +-----------+------------------+-------------------------------------------+

  1.   | host | user | password |  
  2.  

  +-----------+------------------+-------------------------------------------+

  1.   | localhost | root | *MD5加密 |  
  2.  
  3.   | ubuntu | root | *MD5加密 |  
  4.  
  5.   | 127.0.0.1 | root | *MD5加密 |  
  6.  
  7.   | localhost | debian-sys-maint | * MD5加密|  
  8.  

  +-----------+------------------+-------------------------------------------+

  1.   mysql> delete from user where user='root' and host <> '%'--刪除多余用戶  
  2.  
  3.   Query OK, 2 rows affected (0.00 sec)  
  4.  
  5.   mysql> update user set host ='%' where host='localhost' and user='root'--更新host  
  6.  
  7.   Query OK, 1 row affected (0.00 sec)  
  8.  
  9.   Rows matched: 1 Changed: 1 Warnings: 0  
  10.  
  11.   mysql> select host,user,password from user;  
  12.  

  +-----------+------------------+-------------------------------------------+

  | host | user | password |

  +-----------+------------------+-------------------------------------------+

  | % | root | *MD5加密|

  | localhost | debian-sys-maint | * MD5加密|

  +-----------+------------------+-------------------------------------------+

  2 rows in set (0.00 sec)

  注:如果在修改User時失誤出現(xiàn)以下結(jié)果,怎么辦?

  mysql> select host,user,password from user;

  +-----------+------------------+-------------------------------------------+

  | host | user | password |

  +-----------+------------------+-------------------------------------------+

  | ubuntu | root | * MD5加密|

  | localhost | debian-sys-maint | * MD5加密|

  +-----------+------------------+-------------------------------------------+

  2 rows in set (0.00 sec)

  此時沒有127.0.0.1和localhost主機,所以無法用root用戶進行連接,會提示以下錯誤

 

  1.   ~$ mysql -u root -p  
  2.  
  3.   Enter password:  
  4.  
  5.   ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)  
  6.  

  則此時只能用系統(tǒng)自帶的debian-sys-maint用戶登錄,修改host。該用戶的的登錄密碼在/etc/mysql/debian.cnf中明文顯示。

  比如:

  1.   host = localhost 
  2.  
  3.   user = debian-sys-maint  
  4.  
  5.   password = 明文密碼  
  6.  
  7.   socket = /var/run/mysqld/mysqld.sock  
  8.  
  9.   basedir = /usr  
  10.  

  做如下操作:

  1.   ~$ mysql -u debian-sys-maint -p  
  2.  
  3.   Enter password:  
  4.  
  5.   mysql> use mysql;  
  6.  
  7.   mysql> update user set host ='%' where host='ubuntu';  
  8.  
  9.   mysql> exit  
  10.  
  11.   ~$ sudo /etc/init.d/mysql restart  
  12.  

  清理思路,注意操作后需重啟服務(wù)。

【編輯推薦】

Ubuntu10.10下安裝LAMP的方法

Ubuntu下LAMP的PHP錯誤提示的開啟

Ubuntu下LAMP配置文件路徑

責(zé)任編輯:zhaolei 來源: CSDN
相關(guān)推薦

2011-03-14 10:21:25

LAMPMySQL遠程連接

2011-04-19 17:10:12

UbuntuServer遠程連接

2011-03-14 13:07:23

Ubuntu安裝LAMP

2011-03-09 15:44:14

UbuntuLAMP

2011-03-14 11:29:43

2011-03-09 15:13:00

UbuntuLAMP配置

2011-03-10 10:09:09

UbuntuLAMP搭建

2011-03-11 10:27:45

UbuntuLAMP配置

2011-03-10 08:59:04

Ubuntu安裝LAMP

2011-03-10 10:51:45

Ubuntu搭建LAMP

2011-03-08 10:35:23

2011-03-21 16:37:57

2011-03-10 11:06:02

Ubuntu搭建LAMP

2021-01-22 15:18:21

UbuntuLinuxApache

2011-03-22 10:25:54

UbuntuLAMP

2011-03-09 15:25:36

UbuntuLAMPPHPadmin

2011-03-11 10:09:59

UbuntuLAMP路徑

2011-03-21 16:21:21

ubuntulamp

2010-10-19 13:05:31

Sql Server遠

2011-03-10 10:55:38

Ubuntu搭建LAMP
點贊
收藏

51CTO技術(shù)棧公眾號