Navicat for Mysql建立本地连接出现 1044或1045的问题并如何解决。
一、解決1045錯誤問題
在我安裝mysql的過程中,mysql已經安裝成功,可是在建立數據庫鏈接是報錯:Navicat for Mysql建立本地連接出現 1045 -Access denied for user'root'@'ipAddress'(using password :yes) 的問題
實質上1045錯誤最主要的原因就是服務器上的mysql沒有給本地授權。可以通過命令:grant all privileges on *.* to 'root'@'localhost' identified by '你的自己設置的密碼' with grant option; 進行授權
授權過程:用管理員身份運行cmd--輸入mysql--輸入上述命令
授權成功如下圖:
當你輸入命令是可能會出現:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'即1044錯誤問題,下面是解決1044問題的方法
二、解決1044錯誤問題
1044問題實質是因為你的mysql數據庫沒有設值密碼或者密碼不正確導致的。下面介紹兩種解決方法。
方法一:(適用于密碼不正確的)
0、思路:
????通過屏蔽mysql的登錄密碼,先進入mysql內部,再通過update命令更新密碼
1、關閉mysql
????service mysqld stop???//linux下使用???
????net stop mysql????//window下使用?
2、屏蔽權限
????mysqld_safe --skip-grant-table //linux下使用
????mysqld?--skip-grant-table??//window下使用
????或者使用如下命令
????mysqld_safe --user=mysql --skip-grant-tables --skip-networking & //linux下使用
? ? 屏幕出現: Starting demo from .....
3、新開起一個終端輸入
???# mysql -u root mysql
???mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
???mysql> FLUSH PRIVILEGES;???//更新命令???記得要這句話,否則如果關閉先前的終端,又會出現原來的錯誤
???mysql> \q
?
方法二:(適用于存在空密碼)
0、思路
??有時候,mysql雖然擁有了賬號和對應的密碼。但是,由于存在空密碼的情況,會默認登錄到空密碼中。
??需要把空密碼的賬號刪除,可以通過如下命令查看所有賬戶
??select host,user,password from user;
1.關閉mysql
???# service mysqld stop
2.屏蔽權限
???# mysqld_safe --skip-grant-table
???屏幕出現: Starting demo from .....
3.新開起一個終端輸入
???# mysql -u root mysql
???mysql> delete from user where USER='';??//刪除空密碼
???mysql> FLUSH PRIVILEGES;//記得要這句話,否則如果關閉先前的終端,又會出現原來的錯誤
???mysql> \q
1044問題解決參考文獻:https://blog.csdn.net/sea_snow/article/details/82498791
按照上面的命令一步一步的操作,相信你一定能解決問題!!!!
總結
以上是生活随笔為你收集整理的Navicat for Mysql建立本地连接出现 1044或1045的问题并如何解决。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: UML用例图与类图
- 下一篇: RDL和RDLC性能比较