基础知识
https://www.jianshu.com/p/b83d56d2b6fc
安装mysql5.7
参考文档:
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
[root@test ~]# wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
--2018-09-18 14:56:31-- https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.52.176.229
Connecting to repo.mysql.com (repo.mysql.com)|23.52.176.229|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25820 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql80-community-release-el7-1.noarch.rpm’
100%[=====================================================================>] 25,820 --.-K/s in 0.1s
2018-09-18 14:56:37 (190 KB/s) - ‘mysql80-community-release-el7-1.noarch.rpm’ saved [25820/25820]
[root@test ~]# ls
111.pcap 123.pcap anaconda-ks.cfg cap.pcap get-pip.py go mysql80-community-release-el7-1.noarch.rpm ntp_123.csv
[root@test ~]#
[root@test ~]# rpm -Uvh mysql80-community-release-el6-n.noarch.rpm
error: open of mysql80-community-release-el6-n.noarch.rpm failed: No such file or directory
[root@test ~]# rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
warning: mysql80-community-release-el7-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql80-community-release-el7-1 ################################# [100%]
[root@test ~]#vim /etc/yum.repos.d/mysql-community.repo
使能安装mysql57,去使能mysql80
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[root@test ~]#yum -y install mysql-community-server
获取初始密码:
修改密码:
修改db的字符集、开启bin日志功能、修改@@sql_mode的my.cnf配置文件内容:
[root@localhost ~]# cat /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]
character-set-server=utf8
#
# 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
# ch