linux安装mysql8.0

1.上传包到服务器 mysql80-community-release-el7-1.noarch.rpm

2.rpm -Uvh mysql-xxxxx.rpm

3. yum install -y mysql-community-server

 

4. service mysqld start(重启是restart)

查看mysql状态service mysqld status

这样就安装成功了,现在mysql的root账户是没有密码的,继续看下面:
5. vi /etc/my.cnf,在红色位置添加skip-grant-table 或者skip-grant-tables,然后 service mysqld restart


现在可以使用myql -uroot -p进行无密码登录

进入misql后;
1、flush privileges; 刷新
2、alter user'root'@'%' IDENTIFIED BY 'Longyao@123456'; // %是代表可以root进行远程登录,密码必须是数字、大小写和符号组成,这个密码是登录密码
3、exit 退出,然后到my.cnf 删除上面加的内容;
现在使用数据库连接工具还是不能连接,即使密码正确,MYSQL 8.0内新增加mysql_native_password函数,通过更改这个函数密码来进行远程连接。
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY'Longyao@123456';

如果报错 flush privileges;
这样就能正常用root连接使用了。
问题来源:https://blog.csdn.net/yi247630676/article/details/80352655

加入开机自启:rpm自动加入到服务
查看linux开机日志 /var/log
more messages |grep mysql

mysql8.0命令:
查看版本号 :s
创建用户:create user 'tony'@'%' identified by 'tony@2019'
授权 : grant all privileges on *.* to 'tony'@'%'

认证插件:8.0:caching_sha2_password
5.7:mysql_native_password

原文地址:https://www.cnblogs.com/longyao/p/11731189.html