1.目录规划:[q-21528-76294] 网址diguaym.com
程序目录:/usr/local/mysql
数据目录:/data/mysql
PID和SOCKET文件位置:/tmp
2.文件下载:
5.7.22版本下
文件下载大小约614M。
#tar -xzf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
#mv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64/ /usr/local/mysql
3.创建用户和授权:
#useradd mysql
#passwd mysql
#mkdir -p /data/mysql
#chown -R mysql:mysql /data/mysql
#chmod -R 755 /data/mysql
4.设置参数:
[mysqld]
#basic
#skip-grant-tables
#validate_password =OFF
datadir = /data/mysql
port = 3306
pid-file = /tmp/mysql.pid
socket = /tmp/mysql.sock
log_error = error.log
slow-query-log = 1
slow-query-log-file = slow.log
long_query_time = 0.2
log-bin = mysql_bin.log
binlog_format = ROW
expire-logs-days = 1
relay-log = mysql_relay.log
relay_log_recovery = 1
general_log = on
general_log_file = general.log
lower_case_table_names = 1
server-id = 1
character_set_client_handshake = FALSE
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect =‘SET NAMES utf8mb4‘
原文地址:http://blog.51cto.com/13941102/2164679