CentOS7.0里的yum默认不带mysql最新版本(其默认数据库是mariaDB,可替代mysql),所以如果要安装mysql需要参考A Quick Guide to Using the MySQL Yum Repository这个文档。
首先安装rpm源:
wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
然后要选择安装哪个版本,默认是最新版本(8.0),我们希望安装5.7:
yum install yum-utils (如果没有安装过)
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community
检验版本配置成功:
yum repolist enabled | grep mysql
禁用默认的mysql模块(EL8 systems only):
sudo yum module disable mysql
然后执行安装命令:
sudo yum install mysql-community-server –-nogpgcheck
启动mysqld服务:
sudo service mysqld start
mysql安装后会生成一个随机的root用户密码,用下面的命令获取到:
sudo grep 'temporary password' /var/log/mysqld.log
修改root用户密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
欢迎转载
请保留原始链接:https://bjzhanghao.com/p/2274
请保留原始链接:https://bjzhanghao.com/p/2274