CentOS 7.7 yum installed the latest version of MySQL 5.7

1, delete CentOS 7.7 built-in MariaDB related components:

# rpm -qa | grep -i mariadb --> mariadb-libs-5.5.64-1.el7.x86_64

# rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64

If you previously installed MySQL , uninstall: # RPM -qa | grep -i MySQL

If there /etc/my.cnf configuration file, delete: # RM -rf /etc/my.cnf

2, mounting mysql57-Community-Release-el7.rpm :

# rpm -ivh http://repo.mysql.com/mysql57-community-release-el7.rpm

NOTE: After the installation will /etc/yum.repos.d build directory mysql-community-source.repo and mysql-community.repo

3, install MySQL :

# yum list all | grep mysql-community

# yum -y install mysql-community-client mysql-community-common mysql-community-devel mysql-community-libs mysql-community-libs-compat mysql-community-server mysql-community-test

4, to initialize the MySQL : # = MySQL mysqld --user --initialize --datadir = / var / lib / MySQL

Note: Before initialization sure that / var / lib / mysql directory is empty

5, modify /etc/my.cnf configuration file:

# mv /etc/my.cnf /etc/my.cnf.bak

# vim /etc/my.cnf

[mysqld]

port=3306

socket=/var/lib/mysql/mysql.sock

data = / var / lib / mysql

pid-file=/var/run/mysqld/mysqld.pid

log-error=/var/log/mysqld.log

lower_case_table_names=1

character_set_server=utf8mb4

collation_server=utf8mb4_general_ci

innodb_file_per_table=1

skip_name_resolve=1

slow_query_log=1

slow_query_log_file=mysql-slow.log

symbolic-links=0

explicit_defaults_for_timestamp=1

server_id=1

sync_binlog=1

innodb_flush_log_at_trx_commit=1

log_bin=mysql-bin

log_bin_index=mysql-bin.index

binlog_format=row

6, start the MySQL service:

# systemctl start mysqld.service

# systemctl status mysqld.service

# Ps aux | grep mysqld

# Ss -tunlp | grep 3306

# tail -100 /var/log/mysqld.log

7. Configure MySQL service boot from Kai: # systemctl enable mysqld.service

8, see the root @ localhost user's initial password: # grep password /var/log/mysqld.log

9, Configuration MySQL Security Wizard: # mysql_secure_installation

10, authorized root users to remotely log in:

# mysql -uroot -p

mysql> create user root@'192.168.0.%' identified by '123456';

mysql> grant all on *.* to root@'192.168.0.%';

mysql> flush privileges;

image.png

11, using Navicat Premium connection MySQL :

image.png


Guess you like

Origin blog.51cto.com/qiuyue/2446029