erver-id = 2003306
log-bin = /data/mysql/mysql_5624/logs/mybinlog
binlog_cache_size = 4M
max_binlog_size = 1G
max_binlog_cache_size = 2G
sync_binlog = 0
expire_logs_days = 10
#relay log
skip_slave_start = 1
max_relay_log_size = 1G
relay_log_purge = 1
relay_log_recovery = 1
log_slave_updates
#slave-skip-errors=1032,1053,1062
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:1G:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
#端口号为3306的实例特殊配置
[mysqld3306]
port = 3306
#指定本实例相应版本的basedir和datadir
basedir= /usr/local/mysql
datadir = /data/mysql/mysql_5624/data
socket = /tmp/mysql_5624.sock
#重新配置这几个选项,不与全局配置一样,会直接覆盖上面的全局设置
innodb_buffer_pool_size = 100m
transaction_isolation = REPEATABLE-READ
######以下为多个版本mysql时的相关备用参数#####
#[mysqldXXXX]
#port=3308
#basedir= /usr/local/mysql
#datadir= /data/mysql/mysql_XXXX/data
#socket= /tmp/mysql_XXXX.sock
#重新配置这几个选项,不与全局配置一样,会直接覆盖上面的全局设置
#innodb_buffer_pool_size = 100m
#innodb_flush_log_at_trx_commit = 2
#sync_binlog = 0
?
4.2 初始化mysql
特别注意:初始化数据库一定要在basedir目录下进行
#cd /usr/local/mysql
#./scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf
#./scripts/mysql_install_db --datadir=/data/mysql/mysql_5624/data --defaults-file=/etc/my.cnf
5、启动与关闭mysql
5.1 启动mysql
(1)mysql
#/etc/init.d/mysql start
| Starting MySQL... SUCCESS! |
(2)验证mysql是否在运行
#ps axu |grep mysqld
root 3329 0.1 0.0 106272 1412 pts/0 S 08:27 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/mysql_5624/data --pid-file=/data/mysql/mysql_5624/data/mysql.pid
mysql 4267 3.6 29.6 1121464 565388 pts/0 Sl 08:27 0:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_5624/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql_5624/data/error.log --open-files-limit=65535 --pid-file=/data/mysql/mysql_5624/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
(3)验证配置的3306端口是否被监听
#netstat -nalp|grep "3306"
| tcp 0 0 :::3306 :::* LISTEN 4267/mysqld |
?
5.2 关闭mysql
#mysqladmin -uroot shutdown
6、完全卸载Mysql
(1)查询已经安装了的mysql包
#rpm –qa|grep mysql
(2)使用yum完全卸载
# yum