How to Install MySQL 8.0 on CentOS 7
MySQL is an open-source free relational database management system (RDBMS) released under GNU (General Public License). It is used to run multiple databases on any single server by providing multi-user access to each created database.
Step 1: Adding the MySQL Yum Repository
1. We will use the official MySQL Yum software repository, which will provide RPM packages for installing the latest version of MySQL server, client, MySQL Utilities, MySQL Workbench, Connector/ODBC, and Connector/Python for the CentOS 7.
Before Upgrading or Replacing an old MySQL package, don’t forget to take all important database backup and configuration files.
2. Now download and add the following MySQL Yum repository to your respective Linux distribution system’s repository list to install the latest version of MySQL.
# wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
3. After downloading the package for your Linux platform, now install the downloaded package with the following command.
# yum localinstall mysql80-community-release-el7-1.noarch.rpm
4. You can verify that the MySQL Yum repository has been added successfully by using the following command.
# yum repolist enabled | grep "mysql.*-community.*"
Step 2: Installing Latest MySQL Version
5. Install latest version of MySQL using the following command.
# yum install mysql-community-server
Step 3: Installing MySQL Release Series
To install a specific version from specific sub-repository, you can use
--disable options using yum-config-manager as shown:
# yum-config-manager --disable mysql57-community # yum-config-manager --enable mysql56-community
Step 4: Starting the MySQL Server
7. After successful installation of MySQL, it’s time to start the MySQL server with the following command:
# service mysqld start
You can verify the status of the MySQL server with the help of the following command.
# service mysqld status
8. Now finally verify the installed MySQL version using the following command.
# mysql --version
Step 5: Securing the MySQL Installation
9. The command mysql_secure_installation allows you to secure your MySQL installation by performing important settings like setting the root password, removing anonymous users, removing root login, and so on.
Use the below command to see the password before running MySQL secure command.
# grep 'temporary password' /var/log/mysqld.log
Once you know the password you can now run following command to secure your MySQL installation.
Step 6: Connecting to MySQL Server
10. Connecting to a newly installed MySQL server by providing username and password.
# mysql -u root -p
Step 7: Updating MySQL with Yum
11. Besides fresh installation, you can also do updates for MySQL products and components with the help of the following command.
# yum update mysql-server
For any query or issue, feel free to discuss on http://discuss.eduguru.in