[root@linuxidc mysql]# grep -v ^# /etc/my.cnf | grep -v ^$
[client]
port = 3306
socket = /data/mysql/run/mysqld.sock
[mysqld]
port = 3306
socket = /data/mysql/run/mysqld.sock
datadir = /data/mysql/data/ # 新增数据存储目录
back_log = 50
max_connections = 100
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
thread_concurrency = 8
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
default-storage-engine = INNODB # 修改存储引擎为INNODB
thread_stack = 240K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=mysql-bin
binlog_format=mixed
slow_query_log
long_query_time = 2
server-id = 1
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
log-error = /data/mysql/log/mariadb.log # 指定log-file目录
pid-file = /data/mysql/run/mysqld.pid # 指定pid目录
其他参数请自行调整。
[root@linuxidc mysql]# cp -a support-files/mysql.server /etc/init.d/mysqld
[root@linuxidc mysql]# chmod +x /etc/init.d/mysqld
[root@linuxidc mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data/
[root@linuxidc mysql]# service mysqld start
Starting MySQL.170401 09:59:20 mysqld_safe Logging to '/data/mysql/log/mariadb.log'.
170401 09:59:20 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data/
SUCCESS!
[root@linuxidc mysql]# ss -ntlp | grep mysqld
LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=46517,fd=24))
OK, 启动成功。
[root@linuxidc mysql]# cd bin/
[root@linuxidc bin]# pwd
/usr/local/mysql/bin
[root@linuxidc bin]# echo 'export PATH=$PATH:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh
[root@linuxidc bin]# source /etc/profile.d/mysql.sh
[root@linuxidc bin]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.30-MariaDB Source distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
查看jemalloc是否生效: