Installing MySQL on Red Hat Enterprise Linux Using the MySQL Yum Repository.
Installing YUM basic packages of OS.
Download RPM files from http://dev.mysql.com/downloads/repo/yum/ click on download button.
Click on download option on browser copy the URL and execute following command.
If wget command is not working you need to install wget on the server as shown below.
Now we can download RPM packages using wget command.
Give ll command and check repository is saved or not .
Now we can install using below command
Below command shows you enabled repositories.
As shown above by default with the repositories MySQL 5.7 community server and MySQL 5.6 are available.
We will install MySQL 5.6 do so we need to disable MySQL 5.7 community server
Now we need to enable MySQL 5.6 using below command.
As shown below now MySQL 5.6 is enabled.
Now we can install MySQL 5.6 using yum install mysql-community-server command.
[root@ip-172-31-39-223 ec2-user]# yum install mysql-community-server
Above screen is showing 3 options y/d/N
Option “y” is for download and install.
Option “d” is for only download.
Option “N” is to stop process.
Upto here installation has completed . Now we will start the service.
[root@ip-172-31-39-223 ec2-user]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Lets try to login MySQL.
By default you try to login there will not be any password.
As per standard procedure we need to install mysql_secure_installation script
[root@ip-172-31-39-223 ec2-user]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
<span style="color: #ff0000;">Set root password? [Y/n] y</span>
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
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
Remove anonymous users? [Y/n] 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? [Y/n] 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 environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- 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? [Y/n] y
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Yes password has been set for root user. Now try to login .
[root@ip-172-31-39-223 ec2-user]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Now we must & should use -p option .
[root@ip-172-31-39-223 ec2-user]# mysql -uroot -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.6.42 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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.
Using status mysql.service command you can check if MySQL service is running or stopped.
BY default my.cnf stores in /etc folder.
[root@ip-172-31-39-223 ec2-user]# ll /etc/my.cnf
-rw-r--r--. 1 root root 1066 Sep 10 10:32 /etc/my.cnf
Now we can cross check error log location
Now check error log file.
Thank You …………