Centos7 安装Mysql8
简单的安装过程,安装过程中忘记截图了。。。。
1.直接通过wget -i -c https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
下载
2.
yum install -y mysql80-community-release-el7-3.noarch.rpm
3.yum install mysql-community-server -y
很慢
4.systemctl start mysqld.service
启动mysql
5.安装官网的介绍,可以知道临时密码,但是我怎么输入都没有成功
没有办法,直接修改密码吧。
5.1 vim /etc/my.cnf
添加skip-grant-tables, 最好重启一下mysql。systemctl restart mysqld.service
.这样,直接输入mysql即可。
5.2
第一步 一定要清空authentication_string
update user set authentication_string='' where user='root'
第二部 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
这里会提示你密码不符合规范。可以降低规范
SHOW VARIABLES LIKE 'validate_password%'; set global validate_password.policy=LOW; set global validate_password.length=1;
这样就可以修改密码为123456了;
修改完密码之后,再把/etc/my.cnf中skip-grant-tables删除掉。
这样就可以通过密码登录mysql了
6.navicat链接mysql。需要授权才可以,否则无法连接。
很多资料说可以通过
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
但是没有权限,提示没有grant用户。
实际通过
update user set host = "%" where user='root';
FLUSH PRIVILEGES;
即可
注意一定要关闭防火墙,否则navicat提示2003错误
大概记录一下,方便以后用到。。。