安装mysql

yum install libaio libnuma

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files

./bin/mysqld –initialize –user=mysql –basedir=/opt/mysql –datadir=/opt/mysql/data

常用配置选项

[mysqld]
user=mysql
bind-address = 127.0.0.1
port = 3306
socket = /opt/mysql/data/mysql.sock
basedir=/opt/mysql
datadir=/opt/mysql/data

#character
init_connect = 'SET NAMES utf8mb4'
character_set_server=utf8mb4
skip-character-set-client-handshake

#connect
max_connections = 1600
max_connect_errors=9999999
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

#log
slow_query_log=on
slow_query_log_file = /opt/mysql/logs/mysql_slow_query.log


[client]
port = 3306
socket = /opt/mysql/data/mysql.sock
default_character_set = utf8mb4

启动mysql server:
/opt/mysql/bin/mysqld_safe –user=mysql > /dev/null 2>&1 &

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注