运维|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-tablesservice mysqld restartmysql进入mysql mysql -uroot -pupdate user set authentication_string = '' where user = 'root'; exit退出mysql 删除 skip-grant-tablesmysql -uroot -palter user 'root'@'%' identified by 'newpassword';

【运维|hjr-SQL-mysql8 centos】注意区分 ‘root’@’%’ 和 ‘root’@‘localhost’ 两个用户
远程用户 和 本地登录用户

    推荐阅读