In this tutorial we will install latest MySQL package on RHEL/CentOS-6/7. You can easily install MySQL latest package from MySQL community website with latest MySQL yum repository as per operating system version.
Download MySQL yum repository
Download MySQL yum repository rpm package for RHEL/CentOS- 6
Download MySQL yum repository rpm package for RHEL/CentOS- 5
As above we have provided available few rpm URL for different OS version, there are also lot of rpm package are available for Fedora and Oracle operating system compatibility. You can download repository rpm from MySQL community website and install latest MySQL package easily.
Import Note: This tutorial is based on fresh standalone server.
Install MySQL repository
Install yum repository for RHEL/CentOS-6
# rpm -ivh mysql57-community-release-el6-8.noarch.rpm
Now check available repository and enable
# yum repolist all | grep mysql
Enable repository for RHEL/CentOS
# yum repolist enabled | grep “mysql.*-community.*”
Enable repository for Fedora 22 and above
#dnf repolist enabled | grep “mysql.*-community.*”
Installing MySQL package
# yum install mysql-community-server
Start MySQL service on RHEL/CentOS-7
#systemctl start mysqld
On service permanently on startup RHEL/CentOS-7
# systemctl enable mysqld
Start MySQL service on RHEL/CentOS-6
#service mysqld start
#chkconfig mysqld on
Now create password for MySQL root
#run below command to get temporary password in latest mysql server.
# grep ‘temporary password’ /var/log/mysqld.log
2016-07-23T21:59:44.504209Z 1 [Note] A temporary password is generated for root@localhost: y_etaygz%94Q
Note: Put above mysql grep password 1st and if you want to change with new Password than password should be complex like “Redhat@123”. Or you can change the password policy with below command.
Now change and secure password with below command as per below
Securing the MySQL server deployment.
Enter password for user root: (Enter here temp password)
The ‘validate_password’ plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) :
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
By default, MySQL comes with a database named ‘test’ that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
– Dropping test database…
– Removing privileges on test database…
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Check MySQL installed package version
# mysql –version
mysql Ver 14.14 Distrib 5.7.13, for Linux (x86_64) using EditLine wrapper
You are now successfully installed MySQL 5.7.13 package