一、Centos 7安装 mysql 8
- 排查是否已经安装mysql
rpm -qa | grep mysql find / -name mysql
- 查找是否存在yum
yum search mysql-community
- wget 下载rpm
cd /opt mkdir mysql wget https://dev.mysql.com/get/mysql80-community-release-el7-4.noarch.rpm
- 配置安装yum
rpm -Uvh mysql80-community-release-el7-4.noarch.rpm
- 安装mysql
yum install mysql-community-server
- 查看mysql ,启动,关闭mysqld.service
systemctl status mysqld.service systemctl start mysqld.service systemctl stop mysqld.servcie
- 查看安装初始密码,(复制下来)
grep 'temporary password' /var/log/mysqld.log
- 登录mysql,更改密码
mysql -uroot -p 密码:
- 更改密码
ALTER user 'root'@'localhost' IDENTIFIED BY '你的密码';
- 远程登录控制
use mysql; select host,user from user; update user set host='%' where user='root';
- 刷新权限
flush privileges;