1 准备
1.1 下载安装包
官网下载地址:https://dev.mysql.com/downloads/mysql/
版本选择:
2 安装
解压下载的压缩包
进入目录中,执行以下命令:
yum install mysql-community-{server,client,common,libs}-* mysql-5.*
3 启动
# 启动服务
systemctl start mysqld
# 查看初始密码
grep 'temporary password' /var/log/mysqld.log
# 登录
mysql -uroot -p
# 修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
注意:设置密码规则 --> 密码要包含大写、小写字母,数字,特殊符号,至少8个字符。
validate_password is installed by default. The default password policy implemented by validate_password requires that passwords contain at least one uppercase letter, one lowercase letter, one digit, and one special character, and that the total password length is at least 8 characters.
4 配置远程访问
grant all on *.* to 'root'@'%' identified by 'MyNewPass4!';
# 重新加载权限数据
flush privileges;