CentOS7.3 + MySQL8.0环境搭建

参考文档:https://blog.csdn.net/Fmuma/article/details/80386325

参考文档:https://www.cnblogs.com/wishwzp/p/7113403.html

 

1.获取mysql8.0 wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm

如果没有wget,先安装一下,命令:yum -y install wget.然后再执行

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

2.安装mysql 源

yum -y localinstall mysql80-community-release-el7-2.noarch.rpm

3.在线安装mysql

yum -y install mysql-community-server

4.启动mysql

systemctl start mysqld

5.设置开机启动

systemctl enable mysqld

systemctl daemon-reload

6.修改root本地登陆密码

查看mysql 初始化密码:

vi /var/log/mysqld.log

CentOS7.3 + MySQL8.0环境搭建_第1张图片

or grep 'temporary password' /var/log/mysqld.log

7.登陆mysql

mysql -u root -p

8.修改mysql 密码

ALTER USER'root'@'localhost' IDENTIFIED BY 'MyDbPassword@123';

9.重新登陆

10.切换数据库

use mysql

11.查看当前用户

select user,host from user;

12.允许root用户远程访问

GRANT ALL ON *.* TO 'root'@'%'; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'YourDbPassword';

13.记得修改root对用的host为%

update user set host='%' where user='root';

CentOS7.3 + MySQL8.0环境搭建_第2张图片

再执行一次

CentOS7.3 + MySQL8.0环境搭建_第3张图片

14.使用navicat连接或者Dbeaver测试

CentOS7.3 + MySQL8.0环境搭建_第4张图片

15.安装目录:/var/lib/mysql

16.查看mysql服务状态:

sudo service mysqld status

CentOS7.3 + MySQL8.0环境搭建_第5张图片

 

你可能感兴趣的:(环境搭建)