MySQL is an open source database management system. It uses relational database and SQL to manage its data.
We need to make sure that our system is up to date before downloading MySQL.
$ sudo yum update
After upgrading the system, we will install mysql-server rpm package.
$ wget http://repo.mysql.com/mysql-community-release-el7-11.noarch.rpm $ sudo yum update & sudo yum install mysql-server
You will be prompted to create a root password during to installation. Choose a secure password.
You must start the mysql service after installation is completed:
$ sudo systemctl start mysqld
After the installation is finished, we need to start the security script to make MySQL more secure.
This will prompt you for the root password you created before. You can make the following screens as follows. For stronger passwords, you can set the "password validatio policy" to 2. Also, if you want to change root password specified during installation, you can set the "change the password for root?" settings to y for setting new root password.
Securing the MySQL server deployment. Enter password for user root: ALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 Using existing password for root. Estimated strength of the password: 25 Change the password for root ? ((Press y|Y for Yes, any other key for No) : n ... skipping. 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) : n ... skipping. 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!
After the secure installation proccess , we need to make sure mysql-server is running.If MySQL has successfully started, the output should contain Active: active (running)
$ sudo systemctl status mysqld
We can test mysql by typing :
$ mysqladmin -u root -p version Enter password: mysqladmin Ver 8.42 Distrib 5.7.20, for Linux on x86_64 Copyright (c) 2000, 2017, 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 owners. Server version 5.7.20 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysqld/mysqld.sock Uptime: 12 min 50 sec Threads: 1 Questions: 124 Slow queries: 0 Opens: 206 Flush tables: 1 Open tables: 64 Q