5.6和5.7安装有不同,暂时没有时间研究,先记录。
1、5.6版本下载:
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz
2、安装差异
a、5.6 初始化db
./mysql_install_db --basedir=/usr/local/mysql --datadir=/data/db/mysql --defaults-file=/etc/my.cnf --user=mysql
/usr/local/mysql/bin/mysqladmin -u root password ''
b、5.7初始化db
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/db/mysql --pid-file=/usr/local/mysql/mysql.pid
bin/mysql_ssl_rsa_setup --datadir=/data/db/mysql
3、密码设置差异
a、5.6
/usr/local/mysql/bin/mysqladmin -u root password ''
b、5.7
update user set authentication_string=password('.嘻嘻嘻嘻嘻嘻) where User='root';
update user set password_expired='N' where user='root';
4、配置差异
5.7中有部分配置项,5.6的不支持。
对比 5.7中的my.cnf配置文件:5.7mysql安装
5.6版本临时使用配置
[client]
port = port
socket = /usr/local/mysql/mysql.sock
default-character-set = utf8mb4
[mysqld]
default-time_zone = '+8:00'
user = mysql
port = port
socket = /usr/local/mysql/mysql.sock
server-id = 5
pid-file = /usr/local/mysql/mysql.pid
basedir = /usr/local/mysql
datadir = /data/db/mysql/
log-error = /usr/local/mysql/logs/error.log
character_set_server = utf8mb4
collation_server = utf8mb4_bin
back_log = 1024
explicit_defaults_for_timestamp = ON
lower_case_table_names = 0
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
interactive_timeout = 600
wait_timeout = 3600
default_storage_engine = InnoDB