hjr-SQL-mysql8 centos

服务无法启动

删除/var/lib/mysql /后重启MySQL服务

修改密码强度限制

set global validate_password.policy=0;
set global validate_password.length=1;

允许远程访问

CREATE USER 'root'@'%' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
flush privileges;

修改密码

vim /etc/my.cnf
最下面新增
skip-grant-tables

service mysqld restart

mysql进入mysql 

mysql -uroot -p

update user set authentication_string = '' where user = 'root';

exit退出mysql
删除 skip-grant-tables

mysql -uroot -p

alter user 'root'@'%' identified by 'newpassword';


注意区分 ‘root’@’%’ 和 ‘root’@‘localhost’ 两个用户
远程用户 和 本地登录用户


你可能感兴趣的:(运维,Linux)