- 配置yum源:
yum -y localinstall http://file.job520.net/linux/yum-repository/mysql.repo.rpm yum repolist enabled | grep "mysql.*-community.*" # https://dev.mysql.com/downloads/repo/yum/
- 安装:
yum -y install mysql-community-server yum -y install mysql-community-devel
- 设置免密登录:
vim /etc/my.cnf
skip-grant-tables
- 启动服务:
systemctl start mysqld
- 登录:
mysql
- 修改密码:
update mysql.user set authentication_string=password("123456") where user="root";
- 退出:
quit
- 移除免密登录:
vim /etc/my.cnf
# 移除该配置 skip-grant-tables
- 重启:
systemctl restart mysqld
- 输入密码登录:
mysql -uroot -p123456
- 修改密码:
set global validate_password_policy=0; set global validate_password_mixed_case_count=0; set global validate_password_number_count=3; set global validate_password_special_char_count=0; set global validate_password_length=3; Alter USER 'root'@'localhost' IDENTIFIED BY '123456';
- 添加远程访问用户:
grant all on *.* to 'root'@'%' identified by '123456';
- 设置添加用户的授权权限:
update mysql.user set Grant_priv='Y' where Host='%';
- 移除匿名用户:
delete from mysql.user where Host<>'%' or User<>'root';
文档更新时间: 2021-03-28 09:36 作者:lee