Linux学习-MySQL8.0报错
Posted 丢爸
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux学习-MySQL8.0报错相关的知识,希望对你有一定的参考价值。
给SQL用户授权时报错
mysql> grant all on *.* to root@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
####解决方法
#默认root用户不允许远程连接
mysql> select Host,User from user;
+------+------------------+
| Host | User |
+------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+------+------------------+
4 rows in set (0.00 sec)
#更新用户表中的Host为%即可(所有主机可登录 )
mysql> update user set host='%' where User='root';
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0
使用SQLyog连接MySQL8.0报错1
解决方法
#进入MySQL后,修改user表
mysql> alter user root@'%' identified with mysql_native_password by 'Lotus!1120';
Query OK, 0 rows affected (0.00 sec)
使用SQLyog连接MySQL报错2
解决方法
#关闭服务器上的防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
MySQL密码策略
#查看MySQL是否安装了mysql_native_password
mysql> select * from mysql.component;
+--------------+--------------------+------------------------------------+
| component_id | component_group_id | component_urn |
+--------------+--------------------+------------------------------------+
| 1 | 1 | file://component_validate_password |
+--------------+--------------------+------------------------------------+
1 row in set (0.00 sec)
#查看密码设置策略,目前设置为MEDIUM,
mysql> show variables like 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name(是否可以将密码设置成用户名) | ON |
| validate_password.dictionary_file(检查密码字典的文件路径) | |
| validate_password.length(最小长度) | 8 |
| validate_password.mixed_case_count(如策略为中等或更强需要大小写字母) | 1 |
| validate_password.number_count(密码包含的数字数量) | 1 |
| validate_password.policy(密码等级(MEDIUM,STRONG,LOW,LOW/0只检查长度,MEDIUM/1检查长度,数字大小写,特殊字符,STRONG/2检查长度,数字,大小写,特殊字符,字典文件)) | MEDIUM |
| validate_password.special_char_count(特殊字符数量) | 1 |
+--------------------------------------+--------+
7 rows in set (0.00 sec)
#修改密码策略
#设置长度为6
mysql> set global validate_password.length=6;
Query OK, 0 rows affected (0.00 sec)
#将MySQL密码策略级别设置为LOW
mysql> set global validate_password.policy='LOW';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
#修改简单密码
mysql> alter user root@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
以上是关于Linux学习-MySQL8.0报错的主要内容,如果未能解决你的问题,请参考以下文章
Node.js实现对mysql数据库的crud时报加密方式错误解决方案
SQLyog连接MySQL8.0.24远程服务器 ,报错:2058的解决方法