Chances are you’re making use of Linux in its many forms. You might be using it to deploy containers, cloud applications, virtual machines, or some other incarnation of the open source platform. Regardless of how you use Linux, the likelihood that you’ll depend upon a database is fairly high. And if your deployments will depend on a database, MySQL will be a strong candidate. Should your platform be CentOS, MySQL is available for an easy installation.
I want to walk you through the process of installing MySQL on CentOS 7, which is slightly different from installing on other platforms. I’ll be demonstrating on the Minimal version of CentOS 7.
During the installation of CentOS 7, you can install the MySQL database server. On the off-chance you neglected to do so, the installation is but a few quick commands away.
Once you have CentOS 7 up and running, you must add the necessary repository with the commands:
NOTE: You might have to first install wget with the command sudo yum install wget.
After you download that file, install it with the command:
sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
Now you can install the MySQL server with the command:
sudo yum install mysql-server
The installation shouldn’t take much time at all. This particular installation is a bit different from, say, installations on Ubuntu. During the installation, a random password is created for the root MySQL user. You can find that password by issuing the command:
With that password in hand, you’ll need to secure the installation by issuing the commands:
You will be prompted to type the password for the root user. Type the password you found in the log file and hit Enter. You can then create a new password for the MySQL root user and finish up by answering the questions for the mysql_secure_installation process.
SEE: Securing Linux policy (Tech Pro Research)
Testing the installation
To test the installation, let’s log into the MySQL prompt. Just issue the command:
mysql -u root -p
When prompted, type the password you created during the mysql_secure_installation process. You should find yourself at the all-too-familiar MySQL prompt (Figure A).
Ready to go
Congratulations: You now have a working MySQL server on the CentOS 7 Minimal platform. You’re ready to begin building databases and using them for various deployments.
- How to install MyWebSQL on Ubuntu 16.04 (TechRepublic)
- How to connect RazorSQL database client to your MySQL server (TechRepublic)
- How to make MySQL administration simple with Adminer (TechRepublic)
- How to enable phpMyadmin configuration storage to gain more options and security (TechRepublic)
- MongoDB 4.0 aims for cloud-friendliness (ZDNet)
Do you have a favorite MySQL tip or trick? Share your advice with fellow TechRepublic members.