01-Centos7安装mysql8
2018-08-20 本文已影响0人
__流云
1. yum安装
安装教程: https://blog.csdn.net/managementandjava/article/details/80039650
其中指定默认安装路径:yum install mysql-community-server
2. 设置root简单密码
1. 查看默认密码:grep "A temporary password" /var/log/mysqld.log
2. 设置弱密码登录
修改配置文件: vim /etc/my.cnf
在最尾行加上: skip-grant-tables
保存文件
然后重启mysql: service mysqld restart
然后免密码登录mysql: mysql -uroot -p
然后依次执行:
use mysql
update user set authentication_string='' where user='root'
最后执行:quit
再次修改my.cnf, 将末尾添加的 skip-grant-tables 删掉
然后重启mysql: service mysqld restart
使用空密码登录mysql: mysql -uroot -p
然后依次执行:
use mysql
select user,host from user;(查看用户角色)
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
设置密码复杂度为最低级:
set global validate_password.policy=0 ;
set global validate_password.length=6;
修改密码为弱密码:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
3. 开放远程访问
https://blog.csdn.net/weixin_40079336/article/details/81395590