日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

操蛋的linux改mysql密码(1054和1819错误)

發布時間:2025/3/20 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 操蛋的linux改mysql密码(1054和1819错误) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近買了阿里云的linux服務器,幫我裝好tomcat,jdk,mysql鏡像,不怎么會用,在朋友幫助下勉強啟動,但是初始的mysql密碼太過復雜。看了網上linux修改mysql密碼的教程魚龍混雜,跟著試著走卻發現很多bug(1045,和1819錯誤),就想著把步驟總結一下。
linux mysql密碼以及錯誤的解決
輸入:mysql -uroot -p
輸入:(密碼 )//ps:輸入密碼登陸成功
mysql>use mysql; //指明要操作數據庫
mysql> update user set password=passworD(“test”) where user=‘root’;更改密碼
mysql> flush privileges;
mysql> exit;
可能會報錯,未識別password;
就把mysql> update user set password=passworD(“test”) where user=‘root’;更改密碼
換成mysql> update mysql.user set authentication_string=password(‘123456’) where user=‘root’;
可能還會報錯說密碼不符合規范,
那么就修改 validate_password_policy;這個和validate_password_policy有關,具體步驟
mysql> set global validate_password_policy=0;
mysql> select @@validate_password_length;
mysql> select @@validate_password_length;
mysql> set global validate_password_length=1;
mysql> select @@validate_password_length;//再次查看會發現數值變成四,這樣再設置密碼
mysql> update mysql.user set authentication_string=password(‘123456’) where user=‘root’;
mysql> flush privileges;//刷新
mysql> quit//離開

就成功了
運行圖:

[root@iZkt0hekctiwafZ ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.16 MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changedmysql> update user set password=password('123456') where user='root'; ERROR 1054 (42S22): Unknown column 'password' in 'field list'//意思是識別不出password 要把passoword改成authentication_string mysql> update mysql.user set authentication_string=password('123456') where user='root'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements//意思是規則不滿足mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec)mysql> select @@validate_password_length;---------------------------- | @@validate_password_length |---------------------------- | 8 |---------------------------- 1 row in set (0.00 sec)mysql> select @@validate_password_length;---------------------------- | @@validate_password_length |---------------------------- | 8 |---------------------------- 1 row in set (0.00 sec)mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec)mysql> select @@validate_password_length;---------------------------- | @@validate_password_length |---------------------------- | 4 |---------------------------- 1 row in set (0.00 sec)mysql> update mysql.user set authentication_string=password('123456') where user='root'; Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)mysql> quit Bye

在通過本機的nivicat formysql或者其他工具就可以用新密碼登陸服務器的數據庫了。

總結

以上是生活随笔為你收集整理的操蛋的linux改mysql密码(1054和1819错误)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。