Part 1: MySQL Community version Installation on CentOS 7
This article provides the basics of MySQL Community Server installation on Enterprise Linux 7 and every System Admin should know about MySQL basic regular tasks on Linux .
Suggestable Read : CentOS/RHEL 7 Installation
MySQL is the most popular Opensource Relational SQL database management system in use for web server applications in Linux, and it is an open-source database combined with the relational database management system, called as RDBMS. MySQL delivers a secure, cost-effective and enterprise-grade SQL database service for your modern applications.
In CentOS/RHEL 7 , MySQL is not part of default repositories. MariaDB is now DB with CentOS repositories. If you prefer MySQL , then you have to install it from MySQL repositories which are available in community release.
Step :1 IMPORT AND CONFIGURE THE MYSQL REPOSITORIES
Downloading the MySQL community repo package from the mysql repository which is suitable release for Enterprise Linux 7.
|[[email protected]_db ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm|
Installation of mysql repository package with below command
|[[email protected]_db ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm|
Step :2 INSTALL MYSQL COMMUNITY VERSION AND START THE MySQL SERVICES
Installing the Mysql server packages with dependencies using yum command.
|[[email protected]_db ~]# yum install mysql-server|
Enabling the MySQL Service to start automatically while booting OS.
|[[email protected]_db ~]# systemctl enable mysqld.service|
Start the MySQL Service with below command
|[[email protected]_db ~]# systemctl start mysqld.service|
Verifying the MySQL status
|[[email protected]_db ~]# systemctl status mysqld.service|
Step :3 PERFORM THE BASIC MYSQL HARDENING
The following command performs a secure installation of MySQL. This makes MySQL secure by setting a password for the root account, removing the root accounts that access localhost from outside,removes test databases and anonymous user accounts.
|[[email protected]_db ~]# mysql_secure_installation|
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
In order to log into MySQL to secure it, we’ll need the current
Enter current password for root (enter for none):
Setting the root password ensures that nobody can log into the MySQL
Set root password? [Y/n] y
By default, a MySQL installation has an anonymous user, allowing anyone
Remove anonymous users? [Y/n] y
Normally, root should only be allowed to connect from ‘localhost’. This
Disallow root login remotely? [Y/n] n
By default, MySQL comes with a database named ‘test’ that anyone can
Remove test database and access to it? [Y/n] y
All done! If you’ve completed all of the above steps, your MySQL
Thanks for using MySQL!
After secure installation please restart the MySQL service then start the DB operations.
Youtube Video :
Conclusion: We have successfully installed MySQL Community version on CentOS 7, now follow the next article to know about basic commands which help you to administrate the MySQL databases.
Some more articles you might also be interested in.
Part 2: Basic MySQL Commands on Linux
I hope this article will help you to know the basic knowledge about MySQL Database. We want to hear from you. Please share your comments and thoughts below.