centos7.2下安装mysql5.7数据库

服务器上的mysql安装了一个8.0.12版本的,本地的是一个5.7版本的,今天删除了重新安装的5.7版本的,下面是所有的名命令 跟着走就会安装上了。
 
配置源
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

 

yum localinstall mysql57-community-release-el7-8.noarch.rpm

 

# yum repolist enabled | grep "mysql.*-community.*"
安装:
yum install mysql-community-server
启动mysql
systemctl start mysqld
开机自启
systemctl enable mysqld
systemctl daemon-reload
获取初始密码
grep 'temporary password' /var/log/mysqld.log



UjmO#ZA9nt,Y
修改root密码 (需要登录mysql )
mysql -u root -p
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';
授权其他账号远程登录
CREATE USER 'admin'@'%' IDENTIFIED BY 'admin';
GRANT ALL ON *.* TO 'admin'@'%';
flush privileges
posted @ 2019-07-30 19:35  一步一步向上爬  阅读(323)  评论(0编辑  收藏  举报