解決mysql數據庫設置遠程連接權限執行grant all privileges on *.* to 'root'@'%' identified by '密碼' with grant optio報錯
mysql數據庫設置遠程連接權限,執行grant all privileges on *.* to 'root'@'%' identified by '密碼' with grant optio報錯
ERROR1558 (HY000): Column count ofmysql.user is wrong. Expected 43, found 42. Created with MySQL 50556, now running 50639. Please use mysql_upgrade to fix this error.
解決辦法:
使用命令:mysql_upgrade -u[username] -p[password]
就可以解決。
使用mysql_upgrade
對數據庫的數據表結構等升級時,數據庫引擎MyISAM 會做檢查、修復的動作,InnoDB 執行 mysql_upgrade 沒有作用。
查找MySQL的安裝目錄找到mysql_upgrade :
- whereismysql_upgrade
- cd /usr/bin/
- ./mysql_upgrade -uroot -p123 (123為密碼)
然後進入到mysql再執行權限修改即可:grant all privileges on *.* to 'root'@'%' identified by 'root4xml004a' with grant option;
如:
mysql中遠程連接權限語句grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant optio報錯
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant optio
原因: mysql的版本問題,這條語句適用於MySQL8.0之前
解決: mysql8.0及以上版本需要使用以下語句:
create user root@'%' identified by '123456'; grant all privileges on *.* to root@'%' with grant option;
到此這篇關於解決mysql數據庫設置遠程連接權限執行grant all privileges on *.* to 'root'@'%' identified by '密碼' with grant optio報錯的文章就介紹到這瞭,更多相關mysql遠程連接權限內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!
推薦閱讀:
- 解決mysql的賦權操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION問題
- Windows10系統下Mysql8.0.13忘記root密碼的操作方法
- MySQL在grant時報錯ERROR 1064 (42000)的原因及解決方法
- 如何設置mysql允許外部連接訪問
- DeepinV20快速安裝Mariadb的詳細步驟