Linux 安装 MySQL 8
环境:CentOS 7.6
在线安装
Step 1:下载 mysql 的 yum 源
# 添加mysql的yum源存储库
wget https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
# 含义:安装mysql的yum源存储库包
rpm -ivh mysql80-community-release-el7-6.noarch.rpm
Step 2:安装并启动
yum -y install mysql-community-server
# 启动
systemctl restart mysqld.service
# 查看初始密码 a.Fhs<Z7uL=M
cat /var/log/mysqld.log | grep "A temporary password"
Step 3:初始化
# 含义:mysql自己带的初始化程序
mysql_secure_installation
# 输入初始化密码
离线安装
Step 1:下载安装包
安装包下载地址:https://dev.mysql.com/downloads/mysql/
Step 2: 安装并启动
# 上传至服务器
# 解压
tar -xvf mysql-8.0.29-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql
# 安装
cd /usr/local/mysql
yum install *.rpm
# 启动
systemctl restart mysqld.service
# 查看初始密码 a.Fhs<Z7uL=M
cat /var/log/mysqld.log | grep "A temporary password"
Step 3:初始化
# 含义:mysql自己带的初始化程序
mysql_secure_installation
# 输入初始化密码
原创文章,作者:506227337,如若转载,请注明出处:https://blog.ytso.com/274530.html