This guide will outlined how to install MySQL on CentOS 7. MySQL is a widely used database management platform used by various applications. Many applications such as WordPress, Joomla and others rely on MySQL databases to function. MySQL however, must be installed with a few different steps since it’s no longer the default in the CentOS repositories.
All commands without sudo
yum update -y yum install -y wget wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm rpm -ivh mysql-community-release-el7-7.noarch.rpm yum update -y yum install -y mysql-server systemctl start mysqld systemctl enable mysqld mysql_secure_installation
All commands with sudo
sudo yum update -y sudo yum install -y wget sudo wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm sudo rpm -ivh mysql-community-release-el7-7.noarch.rpm sudo yum update -y sudo yum install -y mysql-server sudo systemctl start mysqld sudo systemctl enable mysqld sudo mysql_secure_installation
First, before performing any steps relating to MySQL, we always want to update the system and ensure wget is installed:
yum update -y yum install -y wget
After you’ve installed wget and confirmed the system has updated, we can begin with the installation of MySQL. First we’ll need to download and add the repository. You’ll want to check the latest versions here: https://dev.mysql.com/downloads/repo/yum/ and here: http://repo.mysql.com/ and update the code snippet below accordingly for the rpm.
wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm rpm -ivh mysql-community-release-el7-7.noarch.rpm yum update -y
After the repository has been added, we can proceed with installing MySQL
yum install -y mysql-server
Once installed, we’ll need to start the service and then enable it to start on boot
systemctl start mysqld systemctl enable mysqld
MySQL has now been installed, started and should be running on your server. Please proceed to the next steps for the MySQL Secure Installation to further secure the install.
MySQL Secure Installation:
Run the following command to begin securing the MySQL install. This process will give the options to remove the anonymous accounts, set a root password (other than your server root) and also remove the test databases. We highly recommend that you select YES to all of these options in addition to setting a different MySQL root password.
After you have completed the installation steps above, MySQL has now been installed on your server. You can now proceed with adding & managing databases.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look. Looking for better web hosting? Sign up today and take 50% off your first month with promo code: 1stmonth50
Our Guiding Principles
- Provide consistent, stable and reliable web hosting services.
- Ensure rapid ticket response and quick resolutions to issues.
- Never saturate or over-provision servers to ensure stability and speed for our customers.
- Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
- Provide clear pricing with no hidden fees or gotchas.