mysql8 centos7 安装

找官方下载地址:

https://dev.mysql.com/downloads/mysql/

第一步

选择 red hat x86 64-bit 

选择 RPM包 ,就是第二个360M哪个。

 

第二步:下载rpm包

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-8.0.15-1.el7.x86_64.rpm

第三步: 安装rpm包

rpm -Uvh mysql-community-server-8.0.15-1.el7.x86_64.rpm

第四步: yum安装

yum install mysql-community-server

第五步: 安装完毕,查看密码

tail /var/log/mysqld.log

第六步: 登录mysql

mysql -uroot -p

第7步: 修改初始密码

先把密码策略改一下,@@表示设置持久化,全局变量

set @@global.validate_password.length=4;

set @@global.validate_password.policy=LOW;

改密码

alter user 'root'@'localhost' identified by '123456';

第八步:创建一个超级用户替代root 

create user 'tom'@'%' identified by '123456';

grant all privileges on *.* to 'tom'@'%’;

如果现在用客户端连接,会出现 caching_sha2_xxxx模块缺失,要改一下密码策略

ALTER USER 'tom'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

 FLUSH PRIVILEGES;

记住几个目录:

show variables like '%datadir%';

猜你喜欢

转载自www.cnblogs.com/huangju6/p/10367545.html