How to Install MySQL in Linux

Select the Operating system and OS verstion from the following URL to download Mysql Community Server. I have downloaded the RPM Bundle for Red Hat 5 (64 bit)

https://dev.mysql.com/downloads/mysql/

[root@testdb1 tar]# ls -lrt

total 669412

-rw-r--r-- 1 root root 684800000 Jul 2 23:13 mysql-5.7.18-1.el5.x86_64.rpm-bundle.tar

[root@testdb1 tar]# tar -xf mysql-5.7.18-1.el5.x86_64.rpm-bundle.tar

[root@testdb1 tar]# ls -lrt

total 1338864

-rw-r--r-- 1 7155 31415 41148 Mar 20 10:37 mysql-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 32764550 Mar 20 10:40 mysql-community-client-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 832662 Mar 20 10:40 mysql-community-common-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 5612921 Mar 20 10:40 mysql-community-devel-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 56038478 Mar 20 10:40 mysql-community-embedded-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 193846544 Mar 20 10:40 mysql-community-embedded-devel-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 2977629 Mar 20 10:40 mysql-community-libs-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 2215897 Mar 20 10:40 mysql-community-libs-compat-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 7155 31415 238381979 Mar 20 10:41 mysql-community-server-5.7.18-1.el5.x86_64.rpm

-rw-r--r-- 1 root root 684800000 Jul 2 23:13 mysql-5.7.18-1.el5.x86_64.rpm-bundle.tar

[root@testdb1 tar]# rpm -ivh *.rpm

warning: mysql-5.7.18-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 5072e1f5

Preparing... ########################################### [100%]

1:mysql-community-libs ########################################### [ 11%]

2:mysql-community-common ########################################### [ 22%]

3:mysql-community-client ########################################### [ 33%]

4:mysql-community-embedde########################################### [ 44%]

5:mysql-community-libs-co########################################### [ 56%]

6:mysql ########################################### [ 67%]

7:mysql-community-devel ########################################### [ 78%]

8:mysql-community-embedde########################################### [ 89%]

9:mysql-community-server ########################################### [100%]

[root@testdb1 tar]# rpm -qa | grep -i mysql

mysql-community-devel-5.7.18-1.el5

mysql-community-common-5.7.18-1.el5

mysql-community-libs-5.7.18-1.el5

mysql-community-libs-compat-5.7.18-1.el5

mysql-community-server-5.7.18-1.el5

mysql-community-embedded-5.7.18-1.el5

mysql-community-embedded-devel-5.7.18-1.el5

mysql-community-client-5.7.18-1.el5

mysql-5.7.18-1.el5

[root@testdb1 mysql]# service mysqld start

Initializing MySQL database: [ OK ]

Installing validate password plugin: [ OK ]

Starting mysqld: [ OK ]

Change the root password

[root@testdb1 ~]# grep 'temporary password' /var/log/mysqld.log

2017-07-02T22:19:46.137937Z 1 [Note] A temporary password is generated for root@localhost: bh;Dye47eaL3

[root@testdb1 lib]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

Error: Access denied for user 'root'@'localhost' (using password: YES)

[root@testdb1 lib]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

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) : Yes

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) : No

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

environment.

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

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

[root@testdb1]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 14

Server version: 5.7.18 MySQL Community Server (GPL)

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.

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)