Thursday, November 10, 2016

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

1. Download rpm instalation from http://dev.mysql.com/downloads/mysql/ as sample
MySQL-server-5.6.34-1.el6.x86_64.rpm
MySQL-client-5.6.34-1.el6.x86_64.rpm 
MySQL-devel-5.6.34-1.el6.x86_64.rpm

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.34-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.34-1.el6.x86_64.rpm
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.34-1.el6.x86_64.rpm

2. Remove existing rpm on server
rpm -qa | grep -i '^mysql-'
# rpm -qa | grep -i '^mysql-'
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-community-common-5.7.16-1.el7.x86_64
mysql-community-release-el7-5.noarch
# rpm --nodeps -e mysql-libs-5.1.73-3.el6_5.x86_64
# rpm --nodeps -e mysql-community-common-5.7.16-1.el7.x86_64
# rpm --nodeps -e mysql-community-release-el7-5.noarch

# rpm -qa | grep -i '^mysql-'

#

3. Install MySQL Client, Devel & Server
# rpm -ivh MySQL-server-5.6.34-1.el6.x86_64.rpm
# rpm -ivh MySQL-client-5.6.34-1.el6.x86_64.rpm 
# rpm -ivh MySQL-devel-5.6.34-1.el6.x86_64.rpm

sample log
# rpm -ivh MySQL-client-5.6.34-1.el6.x86_64.rpm
warning: MySQL-client-5.6.34-1.el6.x86_64.rpm : Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
#

# rpm -ivh MySQL-devel-5.6.34-1.el6.x86_64.rpm
warning: MySQL-devel-5.6.34-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
#

# rpm -ivh MySQL-server-5.6.34-1.el6.x86_64.rpm
warning: MySQL-server-5.6.34-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
Giving mysqld 5 seconds to exit nicely
   1:MySQL-server           ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
2016-11-07 16:05:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-07 16:05:59 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2016-11-07 16:05:59 0 [Note] /usr/sbin/mysqld (mysqld 5.6.34) starting as process 33060 ...
2016-11-07 16:05:59 33060 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-11-07 16:05:59 33060 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-07 16:05:59 33060 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-07 16:05:59 33060 [Note] InnoDB: Memory barrier is not used
2016-11-07 16:05:59 33060 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-11-07 16:05:59 33060 [Note] InnoDB: Using Linux native AIO
2016-11-07 16:05:59 33060 [Note] InnoDB: Not using CPU crc32 instructions
2016-11-07 16:05:59 33060 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-11-07 16:05:59 33060 [Note] InnoDB: Completed initialization of buffer pool
2016-11-07 16:05:59 33060 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-11-07 16:05:59 33060 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-11-07 16:05:59 33060 [Note] InnoDB: Database physically writes the file full: wait...
2016-11-07 16:05:59 33060 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-11-07 16:06:00 33060 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-11-07 16:06:00 33060 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-11-07 16:06:00 33060 [Warning] InnoDB: New log files created, LSN=45781
2016-11-07 16:06:00 33060 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-11-07 16:06:00 33060 [Note] InnoDB: Doublewrite buffer created
2016-11-07 16:06:00 33060 [Note] InnoDB: 128 rollback segment(s) are active.
2016-11-07 16:06:00 33060 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-11-07 16:06:00 33060 [Note] InnoDB: Foreign key constraint system tables created
2016-11-07 16:06:00 33060 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-11-07 16:06:00 33060 [Note] InnoDB: Tablespace and datafile system tables created.
2016-11-07 16:06:00 33060 [Note] InnoDB: Waiting for purge to start
2016-11-07 16:06:00 33060 [Note] InnoDB: 5.6.34 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2016-11-07 16:06:00 33060 [Note] Binlog end
2016-11-07 16:06:00 33060 [Note] InnoDB: FTS optimize thread exiting.
2016-11-07 16:06:00 33060 [Note] InnoDB: Starting shutdown...
2016-11-07 16:06:02 33060 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2016-11-07 16:06:02 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-07 16:06:02 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2016-11-07 16:06:02 0 [Note] /usr/sbin/mysqld (mysqld 5.6.34) starting as process 33082 ...
2016-11-07 16:06:02 33082 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-11-07 16:06:02 33082 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-07 16:06:02 33082 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-07 16:06:02 33082 [Note] InnoDB: Memory barrier is not used
2016-11-07 16:06:02 33082 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-11-07 16:06:02 33082 [Note] InnoDB: Using Linux native AIO
2016-11-07 16:06:02 33082 [Note] InnoDB: Not using CPU crc32 instructions
2016-11-07 16:06:02 33082 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-11-07 16:06:02 33082 [Note] InnoDB: Completed initialization of buffer pool
2016-11-07 16:06:02 33082 [Note] InnoDB: Highest supported file format is Barracuda.
2016-11-07 16:06:02 33082 [Note] InnoDB: 128 rollback segment(s) are active.
2016-11-07 16:06:02 33082 [Note] InnoDB: Waiting for purge to start
2016-11-07 16:06:02 33082 [Note] InnoDB: 5.6.34 started; log sequence number 1625977
2016-11-07 16:06:02 33082 [Note] Binlog end
2016-11-07 16:06:02 33082 [Note] InnoDB: FTS optimize thread exiting.
2016-11-07 16:06:02 33082 [Note] InnoDB: Starting shutdown...
2016-11-07 16:06:04 33082 [Note] InnoDB: Shutdown completed; log sequence number 1625987




A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

#

4. start mysql server & enable automatic booting

# service mysql status
MySQL is not running[FAILED]
# service mysql start
Starting MySQL.[  OK  ]
# chkconfig mysql on

5. Configure secure installation & change password root mysql
# mysql_secure_installation
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

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

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


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? [Y/n] 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? [Y/n] n
 ... 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? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
#

6. restart mysql service
# service mysql status
MySQL running (33293)[  OK  ]
# chkconfig mysql on
# /etc/init.d/mysql restart
# service mysql restart

7. then login using root
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.34 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> exit
Bye
#

No comments:

Post a Comment

Popular Posts