In this tutorial, How to install MySQL Server on Centos/RedHat. The default local repository only supports MySQL packages including MySQL (replaced by Mariadb), Mongodb, so forth. In some cases, you need to install the correct MySQL Community server. I will point to a local repository dedicated to MySQL. Linux the essential for DevOps Roles.
My environment
- Centos 7/6.
- MySQL Version 8.
Table of Contents
Install MySQL Server on CentOS 7
Step 1. Disable the current repository on Centos.
Failure to do this will result in conflicting package MongoDB on Epel repository. Install a package management software package:
$ sudo yum install yum-utils
Disable repository ‘remi- *’ and internet MongoDB package if pre-ordered:
$ sudo yum-config-manager --disable \*epel\* $ sudo yum-config-manager --disable \*mongo\*
Step 2. Enable repository MySQL Server.
Create a “/etc/yum.repos.d/MySQL.repo” file with the content as below:
# Enable to use MySQL 5.5 [Local-mysql55-community] name=MySQL 5.5 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/\$releasever/\$basearch/ enabled=0 gpgcheck=0 # Enable to use MySQL 5.6 [Local-mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/\$releasever/\$basearch/ enabled=0 gpgcheck=0 # Enable to use MySQL 5.7 [Local-mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/\$releasever/\$basearch/ enabled=0 gpgcheck=0 [Local-mysql80-community] name=MySQL 8.0 Community Server baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/\$releasever/\$basearch/ enabled=1 gpgcheck=0 [Local-mysql80-mysql-cluster-7.6-community] name=MySQL cluster 7.6 community baseurl=http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/\$releasever/\$basearch/ enabled=1 gpgcheck=0 [Local-mysql-cluster-7.5-community] name=MySQL Cluster 7.5 Community baseurl=http://repo.mysql.com/yum/mysql-cluster-7.5-community/el/7/\$basearch/ enabled=0 gpgcheck=0 [Local-mysql-connectors-community] name=MySQL Connectors Community baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/\$releasever/\$basearch/ enabled=1 gpgcheck=0 [Local-mysql-tools-community] name=MySQL Tools Community baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/\$releasever/\$basearch/ enabled=1 gpgcheck=0 [Local-mysql-tools-preview] name=MySQL Tools Preview baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/\$basearch/ enabled=1 gpgcheck=0
Install the MySQL Community Server package:
$ sudo yum install mysql-community-server
Install another library for MySQL Server (if necessary)
Workbench
$ sudo yum install mysql-workbench-community
Shared client libraries
$ sudo yum install mysql-community-libs
MySQL Cluster server
$ sudo yum install mysql-cluster-community $ sudo yum install mysql-cluster-community-management-server
Shell Tools
$ sudo yum install mysql-shell
Tools
$ sudo yum install mysql-utilities $ sudo yum install mysql-router
Connector
$ sudo yum install mysql-connector-python $ sudo yum install mysql-connector-odbc
Step 3. Disable MongoDB and Enable back the repository epel.
$ sudo yum-config-manager --enable \*epel\* $ sudo yum-config-manager --disable \*mongo\*
To install MySQL Server another version (Option)
MySQL versions other you can enable/disable in the directory: /etc/yum.repos.d/MySQL.repo
Disable the current MySQL version:
$ sudo yum-config-manager --disable Local-mysql\*-community
Enable MySQL version 5.6, type the command:
$ sudo yum-config-manager --enable Local-mysql56-community
Enable MySQL version 5.7, type the command:
$ sudo yum-config-manager --enable Local-mysql57-community
Checking the current MySQL version with the command:
$ sudo yum info mysql-community-server
Reference to MySQL
Conclusion
Thought the article, You can “Install MySQL Server” as above. I hope will this your helpful.
1 thought on “How to install MySQL Server on Centos”