今天想通过idea远程连接Centos7下的Mariadb.一直拒绝访问,最后究其原因是权限配置的问题,现记录如下:
首先授权操作,创建用户同时授权:
mysql> grant all privileges on mq.* to test@localhost identified by '1234';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
MySQL5.7的神奇之处就在于密码太简单不行,会提示你不符合设置规则,所以你只需要以下几个步骤后再创建用户并授权就可以啦:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
1. mysql> set global validate_password_policy=0;
2. Query OK, 0 rows affected (0.05 sec)
4. mysql>
5. mysql>
6. mysql> set global validate_password_mixed_case_count=0;
7. Query OK, 0 rows affected (0.00 sec)
9. mysql> set global validate_password_number_count=3;
10. Query OK, 0 rows affected (0.00 sec)
12. mysql> set global validate_password_special_char_count=0;
13. Query OK, 0 rows affected (0.00 sec)
15. mysql> set global validate_password_length=3;
16. Query OK, 0 rows affected (0.00 sec)
18. mysql> SHOW VARIABLES LIKE 'validate_password%';
19. +--------------------------------------+-------+
20. | Variable_name | Value |
21. +--------------------------------------+-------+
22. | validate_password_dictionary_file | |
23. | validate_password_length | 3 |
24. | validate_password_mixed_case_count | 0 |
25. | validate_password_number_count | 3 |
26. | validate_password_policy | LOW |
27. | validate_password_special_char_count | 0 |
28. +--------------------------------------+-------+
29. 6 rows in set (0.00 sec)
作者:风再起时yhl
链接:https://www.jianshu.com/p/b4848a72e2a4
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
还有数据库设置为utf-8编码问题
查看某个数据库编码
SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "bookstore";
具体设置可参考“参考链接”->数据库编码
参考链接: