Install Step 1. Installing the Yum Warehouse
Go to https://dev.mysql.com/downloads/repo/yum/to download the Yum repository corresponding to the operating system version and install it:sudo rpm -Uvh platform-and-version-specific-package-name.rpm
2. Select the MySQL version you want to install
By default, the latest version of MySQL is activated in the Yum repository that was installed in the previous step, for example now the latest version of MySQL is 5.7, as follows:
shell> yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 community disabledmysql-cluster-7.5-community-source MySQL Cluster 7.5 community-disabledmysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community disabledmysql-cluster-7 .6-community-source MySQL Cluster 7.6 community-disabledmysql-connectors-community/x86_64 MySQL Connectors community Enabled:42mysql-connectors-community-source MySQL Connectors Community-s disabledmysql-tools-community/x86_64 MySQL tools Community enabled:55mysql-tools-community-source mysql Tools community-source disable dmysql-tools-preview/x86_64 MySQL tools preview Disabledmysql-tools-preview-source mysql Tools Preview-source disabledmysql55-community/x86_64 MySQL 5.5 Community Server Disabledmysql55-community-sou RCE MySQL 5.5 Community server-s disabledmysql56-community/x86_64 mysql 5.6 Community Server Dis Abledmysql56-community-source MySQL 5.6 Community server-s disabledmysql57-community/x86_64 mysql 5.7 Community Server enabled: 247mysql57-community-source MySQL 5.7 community server-s disabledmysql80-community/x86_64 MySQL 8 .0 Community Server disabledmysql80-community-source MySQL 8.0 Community server-s Disabled
If you do need to install the latest version of MySQL, you don't need to make any changes.
If you need to install MySQL5.6 instead of the latest version of 5.7 Now, you need to do the following:
shell> sudo yum-config-manager --disable mysql57-communityshell> sudo yum-config-manager --enable mysql56-community
Now let's see what the active version is: apparently the 5.6 version of MySQL.
shell> yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 community disabledmysql-cluster-7.5-community-source MySQL Cluster 7.5 community-disabledmysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community disabledmysql-cluster-7 .6-community-source MySQL Cluster 7.6 community-disabledmysql-connectors-community/x86_64 MySQL Connectors community Enabled:42mysql-connectors-community-source MySQL Connectors Community-s disabledmysql-tools-community/x86_64 MySQL tools Community enabled:55mysql-tools-community-source mysql Tools community-source disable dmysql-tools-preview/x86_64 MySQL tools preview Disabledmysql-tools-preview-source mysql Tools Preview-source disabledmysql55-community/x86_64 MySQL 5.5 Community Server Disabledmysql55-community-sou RCE MySQL 5.5 Community server-s disabledmysql56-community/x86_64 mysql 5.6 Community Server Ena Bled:378mysql56-community-soUrce MySQL 5.6 Community server-s disabledmysql57-community/x86_64 mysql 5.7 Community Server di Sabledmysql57-community-source MySQL 5.7 community server-s disabledmysql80-community/x86_64 MySQL 8 .0 Community Server disabledmysql80-community-source MySQL 8.0 Community server-s Disabled
3. Performing the installation
shell> sudo yum install mysql-community-server
4. Start MySQL
shell> sudo service mysqld start
The MySQL server can be connected after successful startup, and no password is required to log in with the root user.
shell> mysql -uroot -p
Of course, the root password can be changed after successful login:
mysql> update user set Password=password('!Q111111') where User='root';
Note that the root password modified in this way requires the MySQL service to be restarted before it takes effect.
Reference
- https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
Yum Way to install MySQL