Linux(CentOS7)下安装Mysql8数据库

发布时间:2019-06-18 22:00:08发布者:Mr.Zhang阅读(59)

一、Linux版本

二、先下载Linux下的Mysql包,打开Mysql官网

https://www.mysql.com/

点击DOWNLOAD,进入

https://www.mysql.com/downloads/

到页面最底部,点击社区版 community(GPL)Downloads>>,进入

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

继续点击社区版服务器,进入

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

三、选择版本及系统,点击右侧的Download,进入页面

四、最后开始下载

五、下载完成后的包列表

陈列如下

mysql-community-client-8.0.16-2.el7.x86_64.rpm
mysql-community-common-8.0.16-2.el7.x86_64.rpm
mysql-community-devel-8.0.16-2.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-server-8.0.16-2.el7.x86_64.rpm
mysql-community-test-8.0.16-2.el7.x86_64.rpm

六、移除系统原有MySQL包

七、依次安装如下几个rpm包

mysql-community-common-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-8.0.16-2.el7.x86_64.rpm
mysql-community-client-8.0.16-2.el7.x86_64.rpm
mysql-community-server-8.0.16-2.el7.x86_64.rpm

八、初始化mysql

mysqld --initialize --user=mysql

九、查看默认的初始密码

cat /var/log/mysqld.log

十、登录mysql

首先启动mysql服务

service mysqld start

查看一下服务状态是否启动

service mysqld status

使用原始密码登录mysql

mysql -uroot -pdKQqGsDln7?1

修改mysql密码为root

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

新密码登录mysql

mysql -uroot -proot

至此mysql8安装配置完成





本文转自博客园,原文地址:https://www.cnblogs.com/lukefan/p/10406522.html