文龙的_Vlog
Linux 搭建mysql数据库详细步骤

软件共享位置

1.可以去网盘下载
链接:https://pan.baidu.com/s/1DnP4ox6Ad2ur4MDiATn74Q?pwd=my7s
提取码:my7s

2. 官网下载位置
https://dev.mysql.com/downloads/mysql/    

 

安装步骤如下

1. 上传软件包到服务器上

2. 解压软件包(中途报错可能是没有安装解压工具)
tar -xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

 

3. 安装

解压好的rpm软件包
3.1
[root@dcc mysql]# rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm --nodeps --force
警告:mysql-community-common-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中… ################################# [100%]
正在升级/安装…
1:mysql-community-common-8.0.28-1.e################################# [100%]
3.2.
[root@dcc mysql]# rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm --nodeps --force
警告:mysql-community-libs-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中… ################################# [100%]
正在升级/安装…
1:mysql-community-libs-8.0.28-1.el7################################# [100%]
3.3
[root@dcc mysql]# rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm --nodeps --force
警告:mysql-community-client-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中… ################################# [100%]
正在升级/安装…
1:mysql-community-client-8.0.28-1.e################### ( 57%)
3.4
[root@dcc mysql]# rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --nodeps --force
警告:mysql-community-server-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中… ################################# [100%]
正在升级/安装…
1:mysql-community-server-8.0.28-1.e# ( 4%)

 

4. 检查是否安装好mysql软件
rpm -qa | grep mysql

 

 

5.创建mysql用户
chown mysql:mysql /var/lib/mysql -R

 

 

6. 开启mysqld服务设置开启自启动,查看mysqld运行状态。
systemctl start mysqld.service
systemctl enable mysqld
systemctl status mysqld

 

 

 7. 查看mysqld服务初始化密码
cat /var/log/mysqld.log | grep password

 

 

 

8. 登录mysql并修改初始化密码
[root@dcc ~]# mysql -uroot -p
Enter password: 输入初始化密码

 

 

9. 进入数据库命令行下修改密码
mysql> alter user root@localhost identified by ‘713Lwl…’;
mysql> flush privileges;

 

 

 10. 查看服务端口运行状态
[root@dcc ~]# netstat -tunlp | grep mysql
tcp6 0 0 :::3306 ::😗 LISTEN 11063/mysqld
tcp6 0 0 :::33060 ::😗 LISTEN 11063/mysqld

 

 

 11. 通过以下命令,关闭 firewall(防火墙)
systemctl stop firewalld.service;
systemctl disable firewalld.service;
systemctl mask firewalld.service;

 

posted on 2022-03-25 11:04  文龙的_VLOG  阅读(1750)  评论(0编辑  收藏  举报