Percona mysql5.7 Centos/Red Hat - RPM包在安装过程中不显示密码。它是在错误日志中。自动生成的my.cnf包含这行 log-error=/var/log/mysqld.log。
所以,这是我们的密码:
[[email protected] lyh]# cat /var/log/mysqld.log | grep "temporary password"
2017-06-26T04:28:05.537965Z 1 [Note] A temporary password is generated for [email protected]:
ca!wB/i+l7eL
注意!特殊符号需要转义,通过上述登录mysql。
[[email protected] lyh]# mysql -uroot -pca\!wB\/i+l7eL
如果出现以下提示,请按步骤操作即可。
You must reset your password using ALTER USER statement before executing this statement.
step 1: SET PASSWORD = PASSWORD(‘root‘);
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
若提示密码安全级别太低,则需要修改全局变量,如下
step 2: set global validate_password_policy=0;
step 3 set global validate_password_mixed_case_count=2;
step 4: ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
step 5: flush privileges;
授权:grant all on *.* to ‘root‘@‘%‘ identified by ‘Lghs35123‘ with grant option;
开启防火墙端口 centos7:firewall-cmd --zone=public --add-port=3306/tcp --permanent
注意,不同的inux版本的防火墙命令不同。