I - Installing MySQL

0) Remove any old installation, optionally

rpm -qa | grep -i mysql
rpm -qa | grep -i mariadb_libs
yum remove akonadi-mysql-1.9.2-4.el7.x86_64
yum remove qt-mysql-4.8.7-2.el7.x86_64
yum remove perl-DBD-MySQL-4.023-6.el7.x86_64
find / -name "*mysql*"

1) Extract MySQL 5.7 community edition binary archive

cd /mysql/product
tar xzvf /mysql/software/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz

2) Create a symbolic link from the newly extracted directory

ln -s /mysql/product/mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql

3) View the contents of the /usr/local/mysql/bin directory.

cd /usr/local/mysql/bin
ls
innochecksum                mysql_config_editor        mysqlshow
lz4_decompress              mysqld                     mysqlslap
myisamchk                   mysqld-debug               mysql_ssl_rsa_setup
myisam_ftdump               mysqld_multi               mysqltest_embedded
myisamlog                   mysqld_safe                mysql_tzinfo_to_sql
myisampack                  mysqldump                  mysql_upgrade
my_print_defaults           mysqldumpslow              mysqlxtest
mysql                       mysql_embedded             perror
mysqladmin                  mysqlimport                replace
mysqlbinlog                 mysql_install_db           resolveip
mysqlcheck                  mysql_plugin               resolve_stack_dump
mysql_client_test_embedded  mysqlpump                  zlib_decompress

4) Add /usr/local/mysql/bin to root's executable search path

cd
vi .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

export PATH=$PATH:/usr/local/mysql/bin

5) Apply the env changes.

source ~/.bashrc 

6) View the contents of the /etc/my.cnf file.

vi /etc/my.cnf
[mysqld]
datadir=/mysql/data
socket=/mysql/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic_links=0

server_id=1
log_bin=/mysql/arch/binlog

[mysqld_safe]
log_error=/var/log/mysqld.log
pid_file=/var/run/mysqld/mysqld.pid

7) Create mysql as a system user

userdel mysql
groupdel mysql

# no password, not expire, no home directory
adduser -r mysql

8) Initialize the data directory

chown -R mysql.mysql /mysql/arch
chown -R mysql.mysql /mysql/arch

mysqld --initialize
[Note] A temporary password is generated for root@localhost: v%.yokTK9_!n

# Note down the password for later use.

9) Create /var/run/mysqld directory for pid-file option

mkdir /var/run/mysqld
chown mysql:mysql /var/run/mysqld/

10) Launch MySQL by executing the mysqld_safe script

mysqld_safe &

II - Connecting to MySQL

1) Add a [client] option group

vi /etc/my.cnf
[client]
socket=/mysql/data/mysql.sock

2) Launch the mysql command-line client

# you need use the previous generated random password for the first connection
mysql -uroot -p
Enter password: v%.yokTK9_!n

3) Attempt to access the database

mysql> USE mysql; 
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. 

4) Change the MySQL root password

mysql> --change the password for further operation
mysql> ALTER USER USER() IDENTIFIED BY 'mysql'; 

5) Attempt to access the database again

mysql -uroot -pmysql
mysql> use mysql
mysql> use mysql
mysql> select user,host from user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys     | localhost |
| root          | localhost |
+---------------+-----------+
3 rows in set (0.00 sec)

III - Configuring the MySQL Service

1) Stop MySQL by using an appropriate mysqladmin command

mysqladmin -uroot -p shutdown
<mysql>

2) Create a symbolic link for the mysql.server

ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

3) Launch MySQL by thru service command

service mysql start

4) Use the chkconfig for auto startup

chkconfig mysql on
chkconfig --list | grep mysql
mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

[Ref: D61762GC40 - MySQL for Database Administrators]