mysql -pt&ki3u&+ib7X
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
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> set global validate_password.length=1;
Query OK, 0 rows affected (0.00 sec)
繼續修改密碼
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.03 sec)
退出后重新登錄
[root@zabbix-server ~]# mysql -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.22 MySQL Community Server - GPLCopyright (c) 2000, 2020, 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>
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.22 |
+-----------+
1 row in set (0.00 sec)
使用MySQL8.0踩的坑
授權方式改變
mysql5.7
mysql> grant all privileges on *.* to 'kevin'@'%' ;
mysql8.0
mysql> grant all privileges on *.* to 'kevin'@'%' with grant option;
無法遠程連接
MySQL8.0默認是不能使用root賬戶遠程登錄的
修改為可以遠程登錄
mysql> update mysql.user set host='%' where user="root";
mysql> flush privileges;