Mysql Installation Steps on RHEL 6 for Database versions 5.5.x ,5.6.x and 5.7.x

===========================================================
RHEL – 6 And DB Version :5.5.36
===========================================================

[root@hostname ~]# uname -a
Linux hostname.informatica.com 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

[root@hostname ~]# useradd -g dba -u 888 -d /export/home/mysql -m mysql

[root@hostname ~]# passwd mysql
Changing password for user mysql.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

[root@hostname ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

[root@hostname ~]# cd /export/home/
[root@hostname home]# ls -ltr
total 8
drwx——. 3 cloudqa cloudqa 4096 Mar 21 14:37 cloudqa
drwx——. 3 mysql games 4096 Mar 24 12:25 mysql

[root@hostname home]# cd mysql
[root@hostname mysql]# ls -ltr
total 4
drwxr-xr-x. 2 mysql games 4096 Mar 24 12:25 5.5.36

[root@hostname 5.5.36]# pwd
/export/home/mysql/5.5.36

[root@hostname 5.5.36]# ls -ltr
total 145996
-rw-r–r–. 1 mysql games 14975896 Jan 16 2014 MySQL-client-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 4969640 Jan 16 2014 MySQL-devel-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 51901380 Jan 16 2014 MySQL-embedded-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 38962576 Jan 16 2014 MySQL-server-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 1741704 Jan 16 2014 MySQL-shared-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 3969732 Jan 16 2014 MySQL-shared-compat-5.5.36-1.el6.x86_64.rpm
-rw-r–r–. 1 mysql games 32956480 Jan 16 2014 MySQL-test-5.5.36-1.el6.x86_64.rpm

[root@hostname 5.5.36]# rpm -qa | grep -i mysql
mysql-libs-5.1.71-1.el6.x86_64

[root@hostname 5.5.36]# rpm -e mysql-libs-5.1.71-1.el6.x86_64
error: Failed dependencies:
libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

[root@hostname 5.5.36]# rpm -e mysql-libs-5.1.71-1.el6.x86_64 –nodeps

[root@hostname 5.5.36]# rpm -qa | grep -i mysql

[root@hostname 5.5.36]# rpm -ivh MySQL-client-5.5.36-1.el6.x86_64.rpm MySQL-server-5.5.36-1.el6.x86_64.rpm MySQL-shared-5.5.36-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:MySQL-shared ########################################### [ 33%]
2:MySQL-server ########################################### [ 67%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h hostname.informatica.com password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/

3:MySQL-client ########################################### [100%]

[root@hostname 5.5.36]# service mysql status
MySQL is not running [FAILED]

[root@hostname 5.5.36]# service mysql start
Starting MySQL.. [ OK ]

[root@hostname 5.5.36]# service mysql stop
Shutting down MySQL. [ OK ]

[root@hostname 5.5.36]# su – mysql

[mysql@hostname ~]$ mysql_install_db
Installing MySQL system tables…
OK
Filling help tables…
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h hostname.informatica.com password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/

[mysql@hostname ~]$ exit
logout

[root@hostname 5.5.36]# service mysql status
MySQL is not running [FAILED]

[root@hostname 5.5.36]# service mysql start
Starting MySQL.. [ OK ]

[root@hostname 5.5.36]# /usr/bin/mysqladmin -u root password ‘root’

[root@hostname 5.5.36]# mysql -u root -p
Enter password: (root)
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 264.Server version: 5.5.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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 |
| test |
+——————–+

4 rows in set (0.00 sec)
mysql> use mysql;
Reading table information for completion of table and column names.You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host,password from user;
+——+——————————–+—————–
| user | host | password |
+——+——————————–+—————–
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | hostname.informatica.com | |
| root | 127.0.0.1 | |
| root | ::1 | |
| | localhost | |
| | hostname.informatica.com | |
+——+——————————–+—————–
6 rows in set (0.00 sec)

mysql> delete from user where user=’ ‘;
Query OK, 2 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from user;
+——+——————————–+—————–
| user | host | password |
+——+——————————–+—————–
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | hostname.informatica.com | |
| root | 127.0.0.1 | |
| root | ::1 | |
+——+——————————–+—————–
4 rows in set (0.00 sec)

mysql> update user set password=password(‘root’) where user=’root’ and host=’hostname.informatica.com’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into user (host,user,password,select_priv) values (‘%’,’root’,password(‘root’),’Y’);
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on *.* to ‘root’@’%’ with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from user;
+——+——————————–+—————–
| user | host | password |
+——+——————————–+—————–
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | hostname.informatica.com | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | |
| root | ::1 | |
| root | % | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+——+——————————–+—————–
5 rows in set (0.00 sec)

mysql> exit
Bye

[root@hostname 5.5.36]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

[root@hostname 5.5.36]# vi my.cnf

[root@hostname 5.5.36]# vi /etc/my.cnf

[root@hostname 5.5.36]# service mysql restart
Shutting down MySQL. [ OK ]
Starting MySQL.. [ OK ]

[root@hostname 5.5.36]# cat /etc/my.cnf
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M – 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the “–help” option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character_set_server = utf8
collation_server = utf8_general_ci
# Don’t listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the “enable-named-pipe” option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# binary logging format – mixed recommended
binlog_format=mixed

# required unique id between 1 and 2^32 – 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) –
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master’s port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST=’125.564.12.1′, MASTER_PORT=3306,
# MASTER_USER=’joe’, MASTER_PASSWORD=’secret’;
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables’ values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 – 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave – required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master – required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master – required
#master-password = <password>
#
# The port the master is listening on.
# optional – defaults to 3306
#master-port = <port>
#
# binary logging – not required for slaves, but recommended
#log-bin=mysql-bin

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 – 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[root@hostname ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 87.Server version: 5.5.36-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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 variables like ‘%char%’;
+————————–+—————————-+
| Variable_name | Value |
+————————–+—————————-+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+————————–+—————————-+
8 rows in set (0.00 sec)

mysql> show variables like ‘%collat%’;
+———————-+—————–+
| Variable_name | Value |
+———————-+—————–+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+———————-+—————–+
3 rows in set (0.00 sec)

mysql> select version();
+————+
| version() |
+————+
| 5.5.36-log |
+————+
1 row in set (0.00 sec)

*************************************************************************************
END
*************************************************************************************

===================================================================
RHEL 6 – DB Version : 5.6.33
===================================================================

[root@hostname mysql]# pwd
/data/home/mysql

[root@hostname ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

[root@hostname ~]# cd /data/home/mysql/

[root@hostname mysql]# ls -ltr
total 441520
-rw-r–r– 1 7155 31415 18869628 Aug 29 15:41 MySQL-client-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 3389348 Aug 29 15:41 MySQL-devel-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 89395240 Aug 29 15:41 MySQL-embedded-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 56926664 Aug 29 15:42 MySQL-server-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 1962336 Aug 29 15:42 MySQL-shared-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 3969760 Aug 29 15:42 MySQL-shared-compat-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 7155 31415 51528080 Aug 29 15:42 MySQL-test-5.6.33-1.el6.x86_64.rpm
-rw-r–r– 1 root root 226048000 Oct 5 17:05 MySQL-5.6.33-1.el6.x86_64.rpm-bundle.tar

[root@hostname mysql]# rpm -ivh MySQL-client-5.6.33-1.el6.x86_64.rpm
warning: MySQL-client-5.6.33-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@hostname mysql]# rpm -ivh MySQL-shared-5.6.33-1.el6.x86_64.rpm
warning: MySQL-shared-5.6.33-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ########################################### [100%]
1:MySQL-shared ########################################### [100%]
[root@hostname mysql]# rpm -ivh MySQL-server-5.6.33-1.el6.x86_64.rpm
warning: MySQL-server-5.6.33-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ########################################### [100%]
1:MySQL-server ########################################### [100%]
2016-10-06 15:57:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-06 15:57:54 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 5424 …
2016-10-06 15:57:54 5424 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-06 15:57:54 5424 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-06 15:57:54 5424 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-06 15:57:54 5424 [Note] InnoDB: Memory barrier is not used
2016-10-06 15:57:54 5424 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-10-06 15:57:54 5424 [Note] InnoDB: Using Linux native AIO
2016-10-06 15:57:54 5424 [Note] InnoDB: Not using CPU crc32 instructions
2016-10-06 15:57:54 5424 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-06 15:57:54 5424 [Note] InnoDB: Completed initialization of buffer pool
2016-10-06 15:57:54 5424 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-10-06 15:57:54 5424 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-10-06 15:57:54 5424 [Note] InnoDB: Database physically writes the file full: wait…
2016-10-06 15:57:54 5424 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-10-06 15:57:55 5424 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-10-06 15:57:55 5424 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-10-06 15:57:55 5424 [Warning] InnoDB: New log files created, LSN=45781
2016-10-06 15:57:55 5424 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-10-06 15:57:55 5424 [Note] InnoDB: Doublewrite buffer created
2016-10-06 15:57:55 5424 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-06 15:57:55 5424 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-10-06 15:57:55 5424 [Note] InnoDB: Foreign key constraint system tables created
2016-10-06 15:57:55 5424 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-10-06 15:57:55 5424 [Note] InnoDB: Tablespace and datafile system tables created.
2016-10-06 15:57:55 5424 [Note] InnoDB: Waiting for purge to start
2016-10-06 15:57:55 5424 [Note] InnoDB: 5.6.33 started; log sequence number 0
A random root password has been set. You will find it in ‘/root/.mysql_secret’.
2016-10-06 15:57:55 5424 [Note] Binlog end
2016-10-06 15:57:55 5424 [Note] InnoDB: FTS optimize thread exiting.
2016-10-06 15:57:55 5424 [Note] InnoDB: Starting shutdown…
2016-10-06 15:57:57 5424 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2016-10-06 15:57:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-06 15:57:57 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 5446 …
2016-10-06 15:57:57 5446 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-06 15:57:57 5446 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-06 15:57:57 5446 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-06 15:57:57 5446 [Note] InnoDB: Memory barrier is not used
2016-10-06 15:57:57 5446 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-10-06 15:57:57 5446 [Note] InnoDB: Using Linux native AIO
2016-10-06 15:57:57 5446 [Note] InnoDB: Not using CPU crc32 instructions
2016-10-06 15:57:57 5446 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-06 15:57:57 5446 [Note] InnoDB: Completed initialization of buffer pool
2016-10-06 15:57:57 5446 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-06 15:57:57 5446 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-06 15:57:57 5446 [Note] InnoDB: Waiting for purge to start
2016-10-06 15:57:57 5446 [Note] InnoDB: 5.6.33 started; log sequence number 1625977
2016-10-06 15:57:57 5446 [Note] Binlog end
2016-10-06 15:57:57 5446 [Note] InnoDB: FTS optimize thread exiting.
2016-10-06 15:57:57 5446 [Note] InnoDB: Starting shutdown…
2016-10-06 15:57:59 5446 [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

[root@hostname mysql]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rh65x64-lv_root 27G 16G 8.9G 65% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 485M 63M 398M 14% /boot
/dev/mapper/vg0-datavol 99G 51G 43G 55% /data
innfs1:/vol/infastore 5.0T 4.5T 493G 91% /infastore

[root@hostname mysql]# cd /var/lib/

[root@hostname lib]# ls -ltr
total 128
drwxr-xr-x 5 mysql mysql 4096 Oct 6 15:57 mysql

[root@hostname lib]# cd mysql/

[root@hostname mysql]# ls -ltr
total 110612
drwxr-xr-x 2 mysql mysql 4096 Oct 6 15:57 test
-rw-rw—- 1 mysql mysql 50331648 Oct 6 15:57 ib_logfile1
drwx—— 2 mysql mysql 4096 Oct 6 15:57 performance_schema
drwx–x–x 2 mysql mysql 4096 Oct 6 15:57 mysql
-rw-rw—- 1 mysql mysql 50331648 Oct 6 15:57 ib_logfile0
-rw-rw—- 1 mysql mysql 12582912 Oct 6 15:57 ibdata1
-rw-r–r– 1 mysql mysql 111 Oct 6 15:57 RPM_UPGRADE_MARKER-LAST
-rw-r–r– 1 root root 111 Oct 6 15:57 RPM_UPGRADE_HISTORY

[root@hostname mysql]# cd

[root@hostname ~]# su – mysql

[mysql@hostname ~]$ mysql_install_db
WARNING: Could not write to config file /usr/my-new.cnf: Permission denied
Installing MySQL system tables…2016-10-06 15:58:34 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-06 15:58:34 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 5583 …
2016-10-06 15:58:34 5583 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-10-06 15:58:34 5583 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2016-10-06 15:58:34 5583 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-06 15:58:34 5583 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-06 15:58:34 5583 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-06 15:58:34 5583 [Note] InnoDB: Memory barrier is not used
2016-10-06 15:58:34 5583 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-10-06 15:58:34 5583 [Note] InnoDB: Using Linux native AIO
2016-10-06 15:58:34 5583 [Note] InnoDB: Not using CPU crc32 instructions
2016-10-06 15:58:34 5583 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-06 15:58:34 5583 [Note] InnoDB: Completed initialization of buffer pool
2016-10-06 15:58:34 5583 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-06 15:58:34 5583 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-06 15:58:34 5583 [Note] InnoDB: Waiting for purge to start
2016-10-06 15:58:34 5583 [Note] InnoDB: 5.6.33 started; log sequence number 1625987
2016-10-06 15:58:35 5583 [Note] Binlog end
2016-10-06 15:58:35 5583 [Note] InnoDB: FTS optimize thread exiting.
2016-10-06 15:58:35 5583 [Note] InnoDB: Starting shutdown…
2016-10-06 15:58:36 5583 [Note] InnoDB: Shutdown completed; log sequence number 1625997
OK
Filling help tables…2016-10-06 15:58:36 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-06 15:58:36 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 5613 …
2016-10-06 15:58:36 5613 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-10-06 15:58:36 5613 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2016-10-06 15:58:36 5613 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-06 15:58:36 5613 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-06 15:58:36 5613 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-06 15:58:36 5613 [Note] InnoDB: Memory barrier is not used
2016-10-06 15:58:36 5613 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-10-06 15:58:36 5613 [Note] InnoDB: Using Linux native AIO
2016-10-06 15:58:36 5613 [Note] InnoDB: Not using CPU crc32 instructions
2016-10-06 15:58:36 5613 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-10-06 15:58:36 5613 [Note] InnoDB: Completed initialization of buffer pool
2016-10-06 15:58:36 5613 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-06 15:58:36 5613 [Note] InnoDB: 128 rollback segment(s) are active.
2016-10-06 15:58:36 5613 [Note] InnoDB: Waiting for purge to start
2016-10-06 15:58:36 5613 [Note] InnoDB: 5.6.33 started; log sequence number 1625997
2016-10-06 15:58:36 5613 [Note] Binlog end
2016-10-06 15:58:36 5613 [Note] InnoDB: FTS optimize thread exiting.
2016-10-06 15:58:36 5613 [Note] InnoDB: Starting shutdown…
2016-10-06 15:58:38 5613 [Note] InnoDB: Shutdown completed; log sequence number 1626007
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h hostname password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
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
WARNING: Could not copy config file template /usr/share/mysql/my-default.cnf to /usr/my-new.cnf, may not have access rights to do so.
You may want to copy the file manually, or create your own,it will then be used by default by the server when you start it.

[mysql@hostname ~]$ service mysql status
MySQL is not running [FAILED]

[mysql@hostname ~]$ service mysql start
Starting MySQL. [ OK ]

[mysql@hostname ~]$ service mysql restart
Shutting down MySQL.. [ OK ]
Starting MySQL. [ OK ]

[root@hostname ~]# cat /root/.mysql_secret
# The random password set for the root user at Wed Oct 5 17:13:58 2016 (local time): ZiOrHYsfVzQgSz8u

# The random password set for the root user at Thu Oct 6 11:51:06 2016 (local time): JabrTN2yQjSE4kOc

# The random password set for the root user at Thu Oct 6 11:57:30 2016 (local time): 3HssPpZSBNqPjymR

# The random password set for the root user at Thu Oct 6 13:37:10 2016 (local time): 4txHFV0ZoojPxZuj

# The random password set for the root user at Thu Oct 6 15:57:55 2016 (local time): _XgHQ9SAr3WwV1VS

[root@hostname ~]# mysql -u root -p
Enter password:_XgHQ9SAr3WwV1VS
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1.Server version: 5.6.33.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;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

mysql> SET PASSWORD=PASSWORD(‘root’);
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.00 sec)

mysql> exit
Bye

[root@hostname ~]# mysql -u root -p
Enter password:root
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3.Server version: 5.6.33 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 |
| test |
+——————–+
4 rows in set (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host,password from user;
+——+———————-+—————————
| user | host | password |
+——+———————-+—————————
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | hostname | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
| root | 127.0.0.1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
| root | ::1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
+——+———————-+—————————
4 rows in set (0.00 sec)

mysql> update user set password=password(‘root123′) where user=’root’ and host=’hostname′;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> update user set password=password(‘root123′) where user=’root’ and host=’localhost’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> update user set password=password(‘root123′) where user=’root’ and host=’127.0.0.1′;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;select user,host,password from user;
Database changed
+——+———————-+—————————
| user | host | password |
+——+———————-+—————————
| root | localhost | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | hostname | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | 127.0.0.1 | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | ::1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
+——+———————-+—————————
4 rows in set (0.00 sec)

mysql> CREATE USER ‘root’@’%’ identified by ‘root’;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON *.* to ‘root’@’%’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;select user,host,password from user;
Database changed
+——+———————-+—————————
| user | host | password |
+——+———————-+—————————
| root | localhost | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | hostname | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | 127.0.0.1 | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | ::1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
| root | % | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+——+———————-+—————————
5 rows in set (0.00 sec)

mysql> drop user ‘root’@’%’;
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;select user,host,password from user;
Database changed
+——+———————-+—————————
| user | host | password |
+——+———————-+—————————
| root | localhost | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | hostname | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | 127.0.0.1 | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | ::1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
+——+———————-+—————————
4 rows in set (0.00 sec)

mysql> CREATE USER ‘root’@’%’ identified by ‘root123’;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON *.* to ‘root’@’%’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;select user,host,password from user;
Database changed
+——+———————-+——————————————-+
| user | host | password |
+——+———————-+—————————
| root | localhost | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | hostname | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | 127.0.0.1 | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
| root | ::1 | *8348ADE5BCA9FB2892DBCCAB6137F69579CD71E3 |
| root | % | *FAAFFE644E901CFAFAEC7562415E5FAEC243B8B2 |
+——+———————-+—————————
5 rows in set (0.00 sec)

mysql> show variables like ‘%data%’;
+——————————-+————————+
| Variable_name | Value |
+——————————-+————————+
| character_set_database | latin1 |
| collation_database | latin1_swedish_ci |
| datadir | /var/lib/mysql/ |
| innodb_data_file_path | ibdata1:12M:autoextend |
| innodb_data_home_dir | |
| innodb_stats_on_metadata | OFF |
| max_length_for_sort_data | 1024 |
| metadata_locks_cache_size | 1024 |
| metadata_locks_hash_instances | 8 |
| myisam_data_pointer_size | 6 |
| skip_show_database | OFF |
| updatable_views_with_limit | YES |
+——————————-+————————+
12 rows in set (0.00 sec)

mysql> show variables like ‘%port%’;
+———————+——-+
| Variable_name | Value |
+———————+——-+
| innodb_support_xa | ON |
| large_files_support | ON |
| port | 3306 |
| report_host | |
| report_password | |
| report_port | 3306 |
| report_user | |
+———————+——-+
7 rows in set (0.00 sec)

mysql> show variables like ‘%char%’;
+————————–+—————————-+
| Variable_name | Value |
+————————–+—————————-+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+————————–+—————————-+
8 rows in set (0.00 sec)

mysql> show variables like ‘%collat%’;
+———————-+——————-+
| Variable_name | Value |
+———————-+——————-+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+———————-+——————-+
3 rows in set (0.00 sec)

mysql> exit
Bye

[root@hostname ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

[root@hostname ~]# vi /etc/my.cnf

[root@hostname ~]# service mysql restart
Shutting down MySQL.. [ OK ]
Starting MySQL. [ OK ]

[root@hostname ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It’s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[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

# These are commonly set, remove the # and set as required.
basedir = /usr
datadir = /var/lib/mysql
port = 3306
server_id = 1
socket = /var/lib/mysql/mysql.sock
character_set_server = utf8
collation_server = utf8_general_ci

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[root@hostname ~]# cd /var/lib/mysql/

[root@hostname mysql]# ls -ltr
total 110636
drwxr-xr-x 2 mysql mysql 4096 Oct 6 15:57 test
-rw-rw—- 1 mysql mysql 50331648 Oct 6 15:57 ib_logfile1
drwx–x–x 2 mysql mysql 4096 Oct 6 15:57 mysql
-rw-r–r– 1 mysql mysql 111 Oct 6 15:57 RPM_UPGRADE_MARKER-LAST
-rw-r–r– 1 root root 111 Oct 6 15:57 RPM_UPGRADE_HISTORY
drwx—— 2 mysql mysql 4096 Oct 6 15:58 performance_schema
-rw-rw—- 1 mysql mysql 56 Oct 6 15:59 auto.cnf
srwxrwxrwx 1 mysql mysql 0 Oct 6 16:15 mysql.sock
-rw-rw—- 1 mysql mysql 5 Oct 6 16:15 hostname.pid
-rw-r—– 1 mysql mysql 13836 Oct 6 16:15 hostname.err
-rw-rw—- 1 mysql mysql 12582912 Oct 6 16:15 ibdata1
-rw-rw—- 1 mysql mysql 50331648 Oct 6 16:15 ib_logfile0

[root@hostname ~]# cd /var/lib/

[root@hostname lib]# ls -ltr
total 128
drwxr-xr-x 5 mysql mysql 4096 Oct 6 16:15 mysql

[root@hostname lib]# cd mysql/

[root@hostname mysql]# ls -ltr
total 110636
drwxr-xr-x 2 mysql mysql 4096 Oct 6 15:57 test
-rw-rw—- 1 mysql mysql 50331648 Oct 6 15:57 ib_logfile1
drwx–x–x 2 mysql mysql 4096 Oct 6 15:57 mysql
-rw-r–r– 1 mysql mysql 111 Oct 6 15:57 RPM_UPGRADE_MARKER-LAST
-rw-r–r– 1 root root 111 Oct 6 15:57 RPM_UPGRADE_HISTORY
drwx—— 2 mysql mysql 4096 Oct 6 15:58 performance_schema
-rw-rw—- 1 mysql mysql 56 Oct 6 15:59 auto.cnf
srwxrwxrwx 1 mysql mysql 0 Oct 6 16:15 mysql.sock
-rw-rw—- 1 mysql mysql 5 Oct 6 16:15 hostname.pid
-rw-r—– 1 mysql mysql 13836 Oct 6 16:15 hostname.err
-rw-rw—- 1 mysql mysql 12582912 Oct 6 16:15 ibdata1
-rw-rw—- 1 mysql mysql 50331648 Oct 6 16:15 ib_logfile0


*************************************************************************************
END
*************************************************************************************

==================================================================
RHEL 6 And DB Version – 5.7.10
==================================================================

[root@hostname 5.7.10]# pwd
/data/home/mysql/5.7.10

[root@hostname 5.7.10]# ls -ltr
total 428948
-rw-r–r– 1 mysql dba 23788680 Nov 30 18:18 mysql-community-client-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 332252 Nov 30 18:18 mysql-community-common-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 3806848 Nov 30 18:18 mysql-community-devel-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 38364328 Nov 30 18:18 mysql-community-embedded-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 131844000 Nov 30 18:19 mysql-community-embedded-devel-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 2229848 Nov 30 18:19 mysql-community-libs-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 1722356 Nov 30 18:20 mysql-community-libs-compat-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 140055132 Nov 30 18:20 mysql-community-server-5.7.10-1.el6.x86_64.rpm
-rw-r–r– 1 mysql dba 97077452 Nov 30 18:21 mysql-community-test-5.7.10-1.el6.x86_64.rpm

[root@hostname 5.7.10]# rpm -ivh *.rpm
Preparing… ########################################### [100%]
1:mysql-community-common ########################################### [ 11%]
2:mysql-community-libs ########################################### [ 22%]
3:mysql-community-client ########################################### [ 33%]
4:mysql-community-server ########################################### [ 44%]
5:mysql-community-devel ########################################### [ 56%]
6:mysql-community-embedde########################################### [ 67%]
7:mysql-community-embedde########################################### [ 78%]
8:mysql-community-test ########################################### [ 89%]
9:mysql-community-libs-co########################################### [100%]

[root@hostname ~]# cd /var/lib/mysql

[root@hostname mysql]# ll
total 0

[root@hostname mysql]# pwd
/var/lib/mysql

[root@hostname lib]# pwd
/var/lib
[root@hostname lib]# ls -ltr

drwxr-x–x 2 mysql mysql 4096 Nov 30 01:19 mysql

[root@hostname ~]# /etc/init.d/mysqld status
mysqld is stopped

[root@hostname ~]# /etc/init.d/mysqld start
Initializing MySQL database: [ OK ]
Starting mysqld: [ OK ]

[root@hostname mysql]# pwd
/var/lib/mysql

[root@hostname mysql]# ll
total 122964
-rw-r—– 1 mysql mysql 56 Jan 21 11:23 auto.cnf
-rw——- 1 mysql dba 1679 Jan 21 11:23 ca-key.pem
-rw-r–r– 1 mysql dba 1074 Jan 21 11:23 ca.pem
-rw-r–r– 1 mysql dba 1078 Jan 21 11:23 client-cert.pem
-rw——- 1 mysql dba 1679 Jan 21 11:23 client-key.pem
-rw-r—– 1 mysql mysql 408 Jan 21 11:23 ib_buffer_pool
-rw-r—– 1 mysql mysql 12582912 Jan 21 11:23 ibdata1
-rw-r—– 1 mysql mysql 50331648 Jan 21 11:23 ib_logfile0
-rw-r—– 1 mysql mysql 50331648 Jan 21 11:23 ib_logfile1
-rw-r—– 1 mysql dba 12582912 Jan 21 11:23 ibtmp1
drwxr-x— 2 mysql mysql 4096 Jan 21 11:23 mysql
-rw-rw—- 1 root root 6 Jan 21 11:23 mysqld_safe.pid
srwxrwxrwx 1 mysql dba 0 Jan 21 11:23 mysql.sock
-rw——- 1 mysql dba 6 Jan 21 11:23 mysql.sock.lock
drwxr-x— 2 mysql mysql 4096 Jan 21 11:23 performance_schema
-rw——- 1 mysql dba 1679 Jan 21 11:23 private_key.pem
-rw-r–r– 1 mysql dba 451 Jan 21 11:23 public_key.pem
-rw-r–r– 1 mysql dba 1078 Jan 21 11:23 server-cert.pem
-rw——- 1 mysql dba 1675 Jan 21 11:23 server-key.pem
drwxr-x— 2 mysql mysql 12288 Jan 21 11:23 sys

[root@hostname ~]# /etc/init.d/mysqld stop
Stopping mysqld: [ OK ]

[root@hostname ~]# /etc/init.d/mysqld status
mysqld is stopped
[root@hostname ~]#

[root@hostname ~]# /etc/init.d/mysqld start –skip-grant-tables
Starting mysqld: [ OK ]

[root@hostname ~]# /etc/init.d/mysqld status
mysqld (pid 20456) is running…

[root@hostname ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3.Server version: 5.7.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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> use mysql;
Reading table information for completion of table and column names.You can turn off this feature to get a quicker startup with -A
Database changed

mysql> select user,host,authentication_string from user;
+———–+———–+——————————————-+
| user | host | authentication_string |
+———–+———–+——————————————-+
| root | localhost | *DC1ABFDF6B94935C680AD9596F187AA9204A63D3 |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+———–+———–+——————————————-+
2 rows in set (0.00 sec)

mysql> update mysql.user set authentication_string=PASSWORD(‘root’) where user=’root’;flush privileges;
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1

Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,authentication_string from user;
+———–+———–+——————————————-+
| user | host | authentication_string |
+———–+———–+——————————————-+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+———–+———–+——————————————-+
2 rows in set (0.00 sec)

mysql> exit

[root@hostname ~]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]

[root@hostname ~]# /etc/init.d/mysqld status
mysqld (pid 21315) is running…

[root@hostname ~]# mysql -u root -p
Enter password: ———— > (root) password
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3.Server version: 5.7.10
Copyright (c) 2000, 2015, 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;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user ‘root’@’localhost’ identified by ‘root’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> alter user ‘root’@’localhost’ identified by ‘Root@2016’;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>
[root@hostname ~]# mysql -u root -p
Enter password: ——— >Root@2016
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5.Server version: 5.7.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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> select version();
+———–+
| version() |
+———–+
| 5.7.10 |
+———–+
1 row in set (0.00 sec)


*******************************************************************************
END
*******************************************************************************


Comments

Popular posts from this blog

PostgreSQL Database Version 13.4 To MySQL Database Version 8.0.20 Migration by using SQLines Tool

RDS MySQL / MariaDB SSL Connection by using Workbench and command line

Install Mydumper and Myloader Software for Backup of MySQL / MariaDB Databases and Usage of commands