centos+mysql8安装
1、下载rpm源wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm2、查看mysql可下载版本mysql-community-server.x86_64yum list | grep mysql3、下载安装MySQL8yum install -y mysql-community-server.x86_644
1、下载rpm源(https://dev.mysql.com/downloads/repo/yum/)
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
2、查看mysql可下载版本mysql-community-server.x86_64
yum list | grep mysql
如果找不到,执行下面语句后再 yum list | grep mysql
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
3、下载安装MySQL8
yum install -y mysql-community-server.x86_64
4、查看安装是否成功
rpm -qa | grep mysql
5、启动/停止/重启MySQL服务
service mysqld start/stop/restart
查看MySQL服务状态
service mysqld status
6、查看初始随机密码
grep 'temporary password' /var/log/mysqld.log
7、登录后修改密码
use mysql;
alter user 'root'@'localhost' identified by '你的密码';
更改root host
update user set host='%' where user='root';
8、更改MySQL加密方式(mysql8.0默认的加密方式是“caching_sha2_password”,而navicat只支持以前的"mysql_native_password")
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码.';
9、设置远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
flush privileges;
10、防火墙设置(可远程则不用)
添加端口:firewall-cmd --zone=public --add-port=3306/tcp --permanent
重载防火墙:firewall-cmd --reload
mysql8.0和5.7比,改动的地方:
1 修改密码验证(可设置简单密码)
5.7 8.0
set global validate_password_policy=0; set global validate_password.policy=0;
set global validate_password_length=1; set global validate_password.length=1;
2 设置账号远程登陆
5.7:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
8.0 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
更多推荐
所有评论(0)