home Tutorial How to Install MySQL 5.7 on Centos/RHEL 6.X/7.X

How to Install MySQL 5.7 on Centos/RHEL 6.X/7.X

Step 1: Save the Repo File for The MySql 5.7 or Install the RPM for Mysql 5.7

vi /etc/yum.repos.d/mysql-community.repo

name=MySQL 5.7 Community Server

--- save n quit (:wq) ---


————— On RHEL/CentOS 7 —————

wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall mysql57-community-release-el7-7.noarch.rpm

————— On RHEL/CentOS 6 —————

wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
yum localinstall mysql57-community-release-el6-7.noarch.rpm

Step 2: Install Mysql 5.7

yum install mysql-community-server -y

Step 3: Reset the Mysql Temporary root Password and Chacge the password Policy

vi /etc/my.cnf

add these lines below [mysqld]

validate_password_special_char_count =0
validate_password_mixed_case_count = 0

--- save and quit (:wq) ---

service mysqld start
cat /var/log/mysqld.log |grep "temporary password"
2015-09-06T16:46:46.109066Z 1 [Note] A temporary password is generated for root@localhost: <Password>

# mysql_secure_installation

Enter password for user root: <Enter the Temporary Password>

The existing password for the user account root has expired. Please set a new password.

New password: <New Password>

Re-enter new password: <Retype the Password>

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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) : n

... skipping.
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

All done!

Step 4: Check the Version and Mysql Once

mysql -u root -p<password>

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
| Database |
| information_schema |
| mysql |
| performance_schema |
| sys |
4 rows in set (0.00 sec)

mysql> \q

mysql --version

—— DONE, Thanks ——–


Debojyoti Das

System and Database Administrator on Linux and Windows Environment.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: