如果遇到Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
修改权限
ls -la /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
查看初始密码
grep 'temporary password' /var/log/mysqld.log
使用初始密码登录
mysql -uroot -p*****
修改root初始密码,新密码需要包含大写字母,小写字母,数字,特殊符号
ALTER USER 'root'@'localhost' IDENTIFIED BY '****************';
降低密码强度
set global validate_password.policy=0;
set global validate_password.length=1;
创建远程登录账号
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
修改远程协议
ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
允许远程访问
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'WITH GRANT OPTION;
刷新权限
flush privileges;
查看用户表
use mysql;
select host, user, authentication_string, plugin from user;