Tuesday, April 25, 2017

.::: Install MySQL 57 On Linux Rhel/Centos using RPM/Offline :::.


1. Download rpm instalation from http://dev.mysql.com/downloads/mysql/ as sample

mysql-community-common-5.7.16-1.el6.x86_64.rpm
mysql-community-libs-5.7.16-1.el6.x86_64.rpm
mysql-community-devel-5.7.16-1.el6.x86_64.rpm
mysql-community-client-5.7.16-1.el6.x86_64.rpm
mysql-community-server-5.7.16-1.el6.x86_64.rpm

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.16-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.16-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-devel-5.7.16-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.16-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.16-1.el6.x86_64.rpm


[root@TEGUHTH mysql]# ls -lh
total 173M
-rw-r--r-- 1 root root  23M Nov  7 15:19 mysql-community-client-5.7.16-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 328K Nov 10 15:20 mysql-community-common-5.7.16-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 3.6M Nov 10 14:08 mysql-community-devel-5.7.16-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 2.1M Nov  7 15:21 mysql-community-libs-5.7.16-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 144M Nov  7 15:06 mysql-community-server-5.7.16-1.el6.x86_64.rpm
[root@TEGUHTH mysql]#

2. Remove existing rpm on server
rpm -qa | grep -i '^mysql-'
# rpm -qa | grep -i '^mysql-'

[root@TEGUHTH mysql]# rpm -qa | grep -i '^mysql-'
mysql-libs-5.1.73-7.el6.x86_64
[root@TEGUHTH mysql]# rpm --nodeps -e mysql-libs-5.1.73-7.el6.x86_64
[root@TEGUHTH mysql]# rpm -qa | grep -i '^mysql-'
[root@TEGUHTH mysql]#

3. Install MySQL Common, Libs, Devel, Client,  & Server

[root@TEGUHTH mysql]# rpm -ivh *
warning: mysql-community-client-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
    package mysql-community-common-5.7.16-1.el6.x86_64 is already installed
    package mysql-community-libs-5.7.16-1.el6.x86_64 is already installed
    package mysql-community-client-5.7.16-1.el6.x86_64 is already installed
    package mysql-community-server-5.7.16-1.el6.x86_64 is already installed
    package mysql-community-devel-5.7.16-1.el6.x86_64 is already installed
[root@TEGUHTH mysql]# rpm -qa | grep -i '^mysql-'
mysql-community-common-5.7.16-1.el6.x86_64
mysql-community-server-5.7.16-1.el6.x86_64
mysql-community-client-5.7.16-1.el6.x86_64
mysql-community-libs-5.7.16-1.el6.x86_64
mysql-community-devel-5.7.16-1.el6.x86_64
[root@TEGUHTH mysql]#

Or
=========  >>>> alllllll

rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm

[root@TEGUHTH mysql]# rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    mysql-community-libs(x86-64) >= 5.7.9 is needed by mysql-community-client-5.7.16-1.el6.x86_64

[root@TEGUHTH mysql]# rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]

[root@TEGUHTH mysql]# rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
  

[root@TEGUHTH mysql]# rpm -ivh mysql-community-devel-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-devel-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-devel  ########################################### [100%]

[root@TEGUHTH mysql]# rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
  
[root@TEGUHTH mysql]# rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]
  
[root@TEGUHTH mysql]# rpm -qa | grep -i '^mysql-'
mysql-community-client-5.7.16-1.el6.x86_64
mysql-community-common-5.7.16-1.el6.x86_64
mysql-community-devel-5.7.16-1.el6.x86_64
mysql-community-server-5.7.16-1.el6.x86_64
mysql-community-libs-5.7.16-1.el6.x86_64
[root@TEGUHTH mysql]#


=======

4. start mysql server & enable automatic booting
[root@TEGUHTH mysql]# service mysqld status
mysqld is stopped
[root@TEGUHTH mysql]# service mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

[root@TEGUHTH mysql]# chkconfig mysqld on
[root@TEGUHTH mysql]#

[root@TEGUHTH mysql]# service mysqld status
mysqld (pid  3734) is running...
[root@TEGUHTH mysql]#

5. check my.ini
[root@TEGUHTH mysql]# more /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@TEGUHTH mysql]#

6. Check temporary password
[root@SAMLab mysql]# cat /var/log/mysqld.log | grep "temporary password"
2017-04-25T05:16:46.749349Z 1 [Note] A temporary password is generated for root@localhost: .ftUsz<*Q3ql
[root@SAMLab mysql]#

7. Configure secure installation & change password root mysql

[root@SAMLab mysql]# 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:
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) : 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) : 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!
[root@SAMLab mysql]#

8. restart mysql service

[root@TEGUHTH mysql]# service mysqld status
mysqld (pid  29142) is running...
[root@TEGUHTH mysql]# chkconfig mysqld on
[root@TEGUHTH mysql]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@TEGUHTH mysql]# /etc/init.d/mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@TEGUHTH mysql]#

9. then login using root

[root@TEGUHTH mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.16 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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)

mysql> exit
Bye
[root@TEGUHTH mysql]#

10.  disable Mysql Password Validation Plugin

mysql -u root -p
mysql> uninstall plugin validate_password;
Mysql

No comments:

Post a Comment

Popular Posts