下载源:wget https://repo.mysql.com//mysql80-community-release-el8-2.noarch.rpm
安装源:yum install mysql80-community-release-el8-2.noarch.rpm
禁用centos8自带mysql模块:yum module disable mysql
安装:yum install mysql-community-server
开机启动:systemctl enable mysqld
重启:reboot
查看状态:systemctl status mysqld
查看默认密码:grep 'temporary password' /var/log/mysqld.log
登陆:mysql -u root - p
修改密码:alter user 'root'@'localhost' identified by '要修改的密码';
查看密码策略:show variables like 'validate_password%';
设置密码最低长度:set global validate_password.length=6;(密码最低6位)
设置密码验证策略:set global validate_password.policy=0;(最低验证要求)
开启远程访问:
切换数据库:use mysql;
修改用户连接限制:update user set Host = '%' where Host = 'localhost' and User='root';
刷新授权:flush privileges;
云服务器需要在控制台开启3306端口