当前位置:Gxlcms > 数据库问题 > mysql数据库5.7版本部署

mysql数据库5.7版本部署

时间:2021-07-01 10:21:17 帮助过:10人阅读

> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql shell> cd /usr/local shell> tar zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz shell> ln -s mysql-5.7.22-linux-glibc2.12-x86_64 mysql shell> cd mysql shell> cp support-files/mysql.server /etc/rc.d/init.d/mysql.server

3.创建mysql数据库的库文件存放目录

mkdir -p /disk1/mysql/data
mkdir -p /disk1/mysql/securefile
chown -R mysql:mysql /disk1/mysql/

4.编辑/etc/my.cnf文件

[client]
port=3306
socket=/disk1/mysql/mysql.sock
default-character-set=utf8

[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/disk1/mysql/data
socket=/disk1/mysql/mysql.sock
pid-file=/disk1/mysql/mysqld.pid
symbolic-links=1
server-id=1
secure-file-priv=/disk1/mysql/securefile
lower_case_table_names=1
log_timestamps=SYSTEM
#default-storage-engine = InnoDB
#autocommit = on
#transaction-isolation = REPEATABLE-READ
#explicit-defaults-for-timestamp = 1
character-set-server = utf8
#read_only (slave)
skip-host-cache
skip-name-resolve
thread-cache-size = 100
max-allowed-packet = 1024M
max-connections = 4000
max-user-connections = 1000
#max-connect-errors = 100
interactive-timeout=1800
wait-timeout = 1800
open-files-limit=65535
#table-open-cache=2000
#tmpdir = /tmp                        
#slave-load-tmpdir = $MYSQL-DATA/mysqltmp
sql-mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

# MyISAM #
skip-external-locking
#have-query-cache
query-cache-type = 0
query-cache-size = 0
#query-cache-limit=1048576
#query-cache-min-res-unit=4096
key-buffer-size = 64M
tmp-table-size = 64M
max-heap-table-size = 64M
read-buffer-size = 16M
read-rnd-buffer-size = 32M
sort-buffer-size = 2M
join-buffer-size = 2M
#bulk_insert_buffer_size

# INNODB #
innodb-buffer-pool-size = 3G
innodb-sort-buffer-size = 64M
innodb-buffer-pool-instances = 2            
#innodb-buffer-pool-load-at-startup = 1      
#innodb-buffer-pool-dump-at-shutdown = 1  
#innodb-io-capacity = 200
#innodb-io-capacity-max = 2000
#innodb-lru-scan-depth = 1024
#innodb-purge-threads = 4
#innodb_purge_batch_size=300

#innodb-large-prefix = 1
innodb-print-all-deadlocks = 1

#innodb-log-group-home-dir
#25%-100% of innodb buffer pool size 
innodb-log-file-size = 1G
innodb-log-files-in-group = 3
#innodb-log-buffer-size = 16M
#innodb-flush-log-at-trx-commit = 1

# LOGGING #
log-bin=/disk1/mysql/master-bin
#binlog-format=row
expire-logs-days = 7
#max-binlog-size=1G
#sync-binlog = 1
log-bin-trust-function-creators = 1
binlog-cache-size = 1M
#max_binlog_cache_size=18446744073709547520
#log-slave-updates=off

log-error=/disk1/mysql/master.err

general-log=off
general-log-file = /disk1/mysql/master.log

slow-query-log=on
slow-query-log-file = /disk1/mysql/master-slow.log
long-query-time = 3
log-queries-not-using-indexes = 0
#min-examined-row-limit = 0

5.初始化mysql

/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/disk1/mysql/data/

6.启动mysql

/etc/init.d/mysql.server start

 

mysql数据库5.7版本部署

标签:lib   key   files   commit   batch   pid   err   mkdir   sed   

人气教程排行