|

Linux yum安装mysql5.7

//下载源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

//安装源
yum localinstall mysql57-community-release-el7-8.noarch.rpm

//安装mysql
yum install mysql-community-server

//启动服务
systemctl start mysqld

//查看生成的原始密码
grep 'temporary password' /var/log/mysqld.log

//登录mysql
mysql -u root -p //然后输入上面显示的原始密码

//修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

//密码太简单会被拒绝,先把设置的密码的要求改低,在执行改密码
set global validate_password_policy=0; //密码的值
set global validate_password_length=1; //密码长度

//授权给其他机器访问登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

//使生效
FLUSH  PRIVILEGES;

类似文章