CentOS7安装MySQL8
1.下载并安装MySQL官方的 Yum Repository
[root@sweetBaby ~]# wget -i -c https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
[root@sweetBaby ~]# yum -y install mysql80-community-release-el7-1.noarch.rpm
[root@sweetBaby ~]# yum -y install mysql-community-server
2.MySQL数据库设置
启动MySQL
[root@sweetBaby ~]# systemctl start mysqld.service
查找MySQL的默认密码
[root@sweetBaby ~]# grep "password" /var/log/mysqld.log
进入数据库
[root@sweetBaby ~]# mysql -u root -p
输入初始密码,如下命令修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
此时还有一个问题,之前安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉
[root@sweetBaby ~]# yum -y remove mysql57-community-release-el7-10.noarch
进入数据库允许远程连接
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> flush privileges;
退出数据库
mysql> quit;
OK,就这样!
欲买桂花同载酒,终不似,少年游