CentOS 7 install Mysql5.5 or custom version RPM way

There are many ways to install mysql on CentOS 7. I have seen some examples on the Internet, but few of them have succeeded in one step. In fact, the official website has given a very simple way

Official website description

1. Download the rpm source

Official website download address

Because it is CentOS7, I choose Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package

  • Click "download"
  • On the pop-up download page, right click "No thanks, just start my download." Copy the link

For example, I copied it down: https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

mkdir /home/mysql
cd /home/mysql
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

2. Add yum mysql repository

The following naming is executed in the /home/mysql directory, or it can also be executed with a directory path.

rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

If you don't have permission, execute with sudo

3. Customize the version of mysql installed

3.1 View the current installable version

yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community   disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community   disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled
mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:     45
mysql-connectors-community-source  MySQL Connectors Community -  disabled
mysql-tools-community/x86_64       MySQL Tools Community         enabled:     59
mysql-tools-community-source       MySQL Tools Community - Sourc disabled
mysql-tools-preview/x86_64         MySQL Tools Preview           disabled
mysql-tools-preview-source         MySQL Tools Preview - Source  disabled
mysql55-community/x86_64           MySQL 5.5 Community Server    disabled
mysql55-community-source           MySQL 5.5 Community Server -  disabled
mysql56-community/x86_64           MySQL 5.6 Community Server    disabled
mysql56-community-source           MySQL 5.6 Community Server -  disabled
mysql57-community/x86_64           MySQL 5.7 Community Server    enabled:    247
mysql57-community-source           MySQL 5.7 Community Server -  disabled
mysql80-community/x86_64           MySQL 8.0 Community Server    disabled
mysql80-community-source           MySQL 8.0 Community Server -  disabled

enabled, indicates the default installation version, the default is 5.7

3.2 Modify the installation version

关闭5.7版本安装
yum-config-manager --disable mysql57-community
打开55版本安装
yum-config-manager --enable mysql55-community

yum-config-managerIt cannot be executed. This is because the system does not install this command by default. This command is in the yum-utils package and can be yum -y install yum-utilsinstalled through the command.

3.3 Verified version

yum repolist all | grep mysql

or

yum repolist enabled | grep mysql

Check the currently enabled mysql version, if it is the version you set. and it's ready to install.

3.4 Install mysql 5.5

yum install mysql-community-server

The mysql installed by default has no password, please set it as soon as possible.

set password for 'root'@'localhost' = PASSWORD('newpassword');

Advertising column: welcome to follow my personal blog

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325438522&siteId=291194637