mysql8 centos7 安装

 

找官方下载地址:

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

第一步

选择 red hat x86 64-bit 

选择 noarch.RPM包

 

 

 

第二步:下载rpm包

wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm

 

第三步: 安装rpm包

rpm -Uvh mysql80-community-release-el7-2.noarch.rpm

 

第四步: yum安装

yum install mysql-community-server

 

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

tail /var/log/mysqld.log

 

修改密码验证方式

vi /etc/my.cnf

default_authentication_plugin=mysql_native_password

 

第六步: 登录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%';

 

posted @ 2019-02-12 23:49  趟坑的  阅读(1321)  评论(0编辑  收藏  举报