Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svoboda-jan/e18d7c214e2b1ad5d4e8b6599be684d7 to your computer and use it in GitHub Desktop.
Save svoboda-jan/e18d7c214e2b1ad5d4e8b6599be684d7 to your computer and use it in GitHub Desktop.
Install MySQL 5.7 in CentOS7/RHEL7

MySQL 5.7 installation in CentOS 7

sudo su

# Remove MariaDB packages
yum list installed | grep -i maria
yum remove mariadb.x86_64
yum remove mariadb-libs.x86_64

# Download MySQL 5.7 RPM tar
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar
mkdir mysql-5.7-rpm-packages
tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7-rpm-packages
cd mysql-5.7-rpm-packages/

# Don't use 'yum install *.rpm'. It will not work and give error messages
yum install mysql-community-{server,client,common,libs}-* --exclude='*minimal*'
# Start MySQL
systemctl start mysqld
# Enable mysqld service in startup
systemctl enable mysqld

# Get temporary password of root
grep 'A temporary password' /var/log/mysqld.log |tail -1

# Make MySQL secure installation
mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 

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

New password: 

Re-enter new password: 
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password: 

Re-enter new 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) : y

New password: 

Re-enter new 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
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


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

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


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

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

All done! 

Uninstall Password Validation Plugin

uninstall plugin validate_password;

Edit my.cnf for Confluence applications

# Add below line in [mysqld] section
transaction-isolation=READ-COMMITTED

Change a MySQL Data Directory to a New Location on CentOS 7

https://gist.github.com/linuxkathirvel/973de61756e742e1e4e33ce36707b1d2

References

  1. 'yum install' sample is wrong
  2. How to Install MySQL 5.7 on CentOS/RHEL 7/6, Fedora 27/26/25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment