数据库
首页 > 数据库> > mysql安装部署

mysql安装部署

作者:互联网

1、环境准备

yum  -y install wget

2、mysql依赖包下载

wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-client-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-devel-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-embedded-compat-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-libs-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-libs-compat-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-server-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-common-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm
wget https://mirrors.cloud.tencent.com/mysql/downloads/MySQL-8.0/mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm

3、安装 mysql

yum  -y  localinstall ./mysql-community-*

4、修改配置文件(更改数据存放路径)

#创建数据存放文件夹
mkdir /data/mysql -p
#修改mysql配置文件 grep -v -E '^#|^$' /etc/my.cnf [mysqld] port=3306 default-storage-engine=InnoDB max_connections=1200 datadir=/data/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid log_slave_updates=ON log_bin=mysql-bin binlog_format=ROW

5、启动并加入开机自启

systemctl enable --now mysqld

6、修改密码

# grep password /var/log/mysqld.log
2022-04-13T07:31:54.168545Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: hBHJda&;a7PL

# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY "Admin@123";

 

 

标签:8.0,部署,MySQL,28,community,mysql,wget,安装
来源: https://www.cnblogs.com/lxd0224/p/16401543.html