How to Install MySQL Server using MySQL Yum Repository
Hello,
The MySQL Yum repository for Oracle Linux, Red Hat Enterprise Linux, CentOS, and Fedora provides RPM packages for installing the MySQL server, client, MySQL Workbench, MySQL Utilities, MySQL Router, MySQL Shell, Connector/ODBC, Connector/Python and so on (not all packages are available for all the distributions
Now let’s see how to do it.
Step 1 ) Add the MySQL Yum repository to your system’s repository list.
a) Go to the Download MySQL Yum Repository page (http://dev.mysql.com/downloads/repo/yum/) in the MySQL Developer Zone.
b) Select and download the release package for your machine.
c) Install the downloaded release package with the following command
[root@vps ~]# yum localinstall downloaded_package.rpm
Step 2 ) You can verify whether MySQL yum repository is added to your local repository by issuing following the command.
[root@vps ~]# yum repolist enabled | grep "mysql"
Step 3 ) Within the MySQL Yum repository, different release series of the MySQL Community Server are hosted in different sub-repositories. you can also select a release series by editing manually the /etc/yum.repos.d/mysql-community.repo
file. This is a typical entry for a release series’ subrepository in the file:
[mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
The typical MySQL sub-repositories show in above. You may find many sub-repositories within the MySQL yum repository. You can disable / enable the require sub repositories by changing “enabled” to 0 or 1.
If you change to 1, It means that sub-repositories enabled. And 0 means disabled.
Step 4 ) Installing MySQL.
Install MySQL by the following command
[root@vps ~]# yum install mysql-community-server
Step 5 ) Start the MySQL server with the following command:
[root@vps ~]# systemctl start mysqld
You can check the status of the MySQL server with the following command:
[root@vps ~]# systemctl status mysqld
Step 6 ) Now you have to set root password MySQL. You can do it by issuing below command.
[root@vps ~]# mysqladmin -u root password 'new-password'
Now you can login to your MySQL server by the below command and then try your password.
[root@vps ~]# mysql -u root -p
Thanks for reading this tutorial 🙂