1. 新安装的mysql在登陆时候,提供了一个临时的密码,且在使用临时密码登录后必须修改密码才能继续使用。
使用rpm包安装的mysql,临时密码储存在/var/log/mysqld.log
查看临时密码:
grep ‘temporary password‘ /var/log/mysqld.log ;
2.使用临时密码登录:
mysql -uroot -p‘临时密码‘
修改密码:
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘新密码‘;
PS:
在测试的时候不想要设置很复杂的密码,MySQL的默认密码强度是2(strong)。
0
or LOW Length
1
or MEDIUM Length; numeric, lowercase/uppercase, and special characters;
2
or STRONG
Length; numeric, lowercase/uppercase, and special characters; dictionary file
设置的密码强度不符合,会报错:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
使用 set global validate_password_policy=0;修改密码强度要求。
使用 select @@validate_password_length; 查看密码长度要求
+-----------------------------------------+
| @@validate_password_length |
+-----------------------------------------+
| 8 |
+-----------------------------------------+
3.应用更改:
grant all privileges on *.* to [email protected]"%" identified by "root密码";
flush privileges;
service iptables stop
PS:安装注意的事项:
这次是使用的rpm包在centos6.5安装的mysql5.7版本,
下载完整的压缩包后,解压出来的如下:
mysql-community-client-5.7.24-1.el6.x86_64.rpm
mysql-community-common-5.7.24-1.el6.x86_64.rpm
mysql-community-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
mysql-community-server-5.7.24-1.el6.x86_64.rpm
mysql-community-test-5.7.24-1.el6.x86_64.rpm
安装顺序是要求为
rpm -ivh mysql-community-common*
rpm -ivh mysql-community-libs-5.7*
rpm -ivh mysql-community-client*
rpm -ivh mysql-community-server*
原文地址:https://www.cnblogs.com/zeroisbug/p/10128099.html