連線MYSQL資料庫,報1130錯誤的解決方法

2022-09-13 09:21:14 字數 2931 閱讀 8391

重灌mysql(重灌之前要先檢查一下是不是已經存在mysql服務,如果存在,先把已有的mysql服務刪除),由於不知道重灌之前的root密碼,使用重灌之後的密碼連線mysql資料,總報 error 1130: host 'localhost' not allowed to connect to this mysqlserver,不能連線資料庫,猜測使用者許可權和密碼的問題。

1、用root使用者登入mysql資料庫

(1)停止mysql服務,執行net stop mysql;

(2)在mysql的安裝路徑下找到配置檔案my.ini,

找到[mysqld]

輸入:skip-grant-tables,儲存

(3)重啟mysql服務,net start mysql;

(4)執行mysql -uroot -p,回車,再回車,即可進入mysql資料庫;

2、在本機登入mysql後,更改 「mysql」 資料庫裡的 「user」 表裡的 「host」 項,從」localhost」改稱'%'。

mysql>use mysql;

查詢出資料庫的使用者名稱

mysql>select host,user,password from user;

把使用者表裡面的host項改為「%」

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

mysql>flush privileges;    #重新整理使用者許可權表

mysql>select host,user,password  from user where user='root';

3、插入本地登入的使用者

mysql>insert into user values('localhost', 'root', '', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y','','','','',0,0,0,0,'','');

此時本地連線的使用者localhost密碼為空

4、修改root密碼

用update方式修改root密碼正常

mysql> update user set password=password("123") where user="root";

mysql>flush privileges; 

5、退出mysql,在配置檔案中注釋:skip-grant-tables,重啟mysql服務

6、本地重新連線mysql資料庫,輸入修改後的密碼,連線成功

重灌mysql(重灌之前要先檢查一下是不是已經存在mysql服務,如果存在,先把已有的mysql服務刪除),由於不知道重灌之前的root密碼,使用重灌之後的密碼連線mysql資料,總報 error 1130: host 'localhost' not allowed to connect to this mysqlserver,不能連線資料庫,猜測使用者許可權和密碼的問題。

1、用root使用者登入mysql資料庫

(1)停止mysql服務,執行net stop mysql;

(2)在mysql的安裝路徑下找到配置檔案my.ini,

找到[mysqld]

輸入:skip-grant-tables,儲存

(3)重啟mysql服務,net start mysql;

(4)執行mysql -uroot -p,回車,再回車,即可進入mysql資料庫;

2、在本機登入mysql後,更改 「mysql」 資料庫裡的 「user」 表裡的 「host」 項,從」localhost」改稱'%'。

mysql>use mysql;

查詢出資料庫的使用者名稱

mysql>select host,user,password from user;

把使用者表裡面的host項改為「%」

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

mysql>flush privileges;    #重新整理使用者許可權表

mysql>select host,user,password  from user where user='root';

3、插入本地登入的使用者

mysql>insert into user values('localhost', 'root', '', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y','','','','',0,0,0,0,'','');

此時本地連線的使用者localhost密碼為空

4、修改root密碼

用update方式修改root密碼正常

mysql> update user set password=password("123") where user="root";

mysql>flush privileges; 

5、退出mysql,在配置檔案中注釋:skip-grant-tables,重啟mysql服務

6、本地重新連線mysql資料庫,輸入修改後的密碼,連線成功

解決遠端登入mysql資料庫報1130錯誤

現象 安裝好mysql後,發現phpmyadmin不能登入mysql,返回1130錯誤,但是在mysql命令列登入mysql u root p可以 分析過程及解決方案 mysql u root p mysql use mysql mysql select host from user where u...

mysql連線本地資料庫報10061

具體問題 除10061報錯,任務管理器 ctrl shift esc 中無mysqld.exe程序,嘗試啟動mysql服務,啟動幾秒狀態又停止 解決方法 以管理員身份執行cmd win r 此處mysql安裝路徑為d program files x86 mysql mysql 8.0.20 cmd中...

1130 資料庫操作

嚴格模式 建立物件 strict false 關閉嚴格模式 關閉嚴格模式 就可以根據條件來進行刪除 不關閉嚴格模式 不關只能獲取到post引數 不關閉都響應 不獲取 mongdb 操作 自定義 路徑 自定義 const contentmodel new mongoose.model content ...