三思—mysql安装配置手册(二)——-my.cnf
2013-10-11 18:43
886 查看
编辑和修改my.cnf配置文件,下列内容仅供参考:
[root@mysqldb2 mysql]# vi /data/mysqldata/3306/my.cnf
[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock
character-set-server = utf8
# Here follows entries for some specific programs
# The
[mysqld]
port = 3306
user = mysql
socket = /data/mysqldata/3306/mysql.sock
pid-file = /data/mysqldata/3306/mysql.pid
basedir = /usr/local/mysql
datadir = /data/mysqldata/3306/data
tmpdir = /data/mysqldata/3306/tmp
open_files_limit = 10240
server-id = 303306
lower_case_table_names = 1
character-set-server = utf8
skip-name-resolve
max_connections = 1000
max_connect_errors = 100000
max_allowed_packet = 512M
max_heap_table_size = 1024M
max_length_for_sort_data = 4096
back_log=100
interactive_timeout = 600
wait_timeout = 600
default-storage-engine = InnoDB
net_buffer_length = 8K
sort_buffer_size = 2M
join_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
query_cache_size = 128M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_cache_size = 300
table_open_cache = 1024
tmp_table_size = 256M
#*********** Logs related settings ***********
log-bin = /data/mysqldata/3306/binlog/mysql-bin
binlog_format=row
binlog_cache_size=32m
max_binlog_cache_size=512m
max_binlog_size=512m
long_query_time = 3
log_output = FILE
log-error = /data/mysqldata/3306/mysql-error.log
slow_query_log = 1
slow_query_log_file = /data/mysqldata/3306/slow_statement.log
log_queries_not_using_indexes
general_log = 0
general_log_file = /data/mysqldata/3306/general_statement.log
expire-logs-days = 14
#*********** MyISAM Specific options ***********
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 Specific options ***********
innodb_file_per_table
transaction-isolation = READ-COMMITTED
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 1024M
innodb_data_home_dir = /data/mysqldata/3306/innodb_ts
innodb_data_file_path = ibdata1:2048M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 0
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
innodb_log_group_home_dir = /data/mysqldata/3306/innodb_log
innodb_flush_log_at_trx_commit = 2
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 120
innodb_flush_method=O_DIRECT
[mysqldump]
quick
max_allowed_packet = 512M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with
#safe-updates
[myisamchk]
key_buffer_size = 32M
sort_buffer_size = 20M
read_buffer_size = 2M
write_buffer_size = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
启动数据库:
[root@mysqldb2 mysql]# mysqld_safe –defaults-file=/data/mysqldata/3306/my.cnf &
设置超级用户密码:
[root@mysqldb2 mysql]# mysqladmin -uroot password ’verysafe’ -S /data/mysqldata/3306/mysql.sock
使用mysql命令行连接:
[root@mysqldb2 mysql]# mysql -uroot -pverysafe -S /data/mysqldata/3306/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 271570
Server version: 5.1.51-junsansi-edition-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
done~~~
[root@mysqldb2 mysql]# vi /data/mysqldata/3306/my.cnf
[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock
character-set-server = utf8
# Here follows entries for some specific programs
# The
[mysqld]
port = 3306
user = mysql
socket = /data/mysqldata/3306/mysql.sock
pid-file = /data/mysqldata/3306/mysql.pid
basedir = /usr/local/mysql
datadir = /data/mysqldata/3306/data
tmpdir = /data/mysqldata/3306/tmp
open_files_limit = 10240
server-id = 303306
lower_case_table_names = 1
character-set-server = utf8
skip-name-resolve
max_connections = 1000
max_connect_errors = 100000
max_allowed_packet = 512M
max_heap_table_size = 1024M
max_length_for_sort_data = 4096
back_log=100
interactive_timeout = 600
wait_timeout = 600
default-storage-engine = InnoDB
net_buffer_length = 8K
sort_buffer_size = 2M
join_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
query_cache_size = 128M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_cache_size = 300
table_open_cache = 1024
tmp_table_size = 256M
#*********** Logs related settings ***********
log-bin = /data/mysqldata/3306/binlog/mysql-bin
binlog_format=row
binlog_cache_size=32m
max_binlog_cache_size=512m
max_binlog_size=512m
long_query_time = 3
log_output = FILE
log-error = /data/mysqldata/3306/mysql-error.log
slow_query_log = 1
slow_query_log_file = /data/mysqldata/3306/slow_statement.log
log_queries_not_using_indexes
general_log = 0
general_log_file = /data/mysqldata/3306/general_statement.log
expire-logs-days = 14
#*********** MyISAM Specific options ***********
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 Specific options ***********
innodb_file_per_table
transaction-isolation = READ-COMMITTED
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 1024M
innodb_data_home_dir = /data/mysqldata/3306/innodb_ts
innodb_data_file_path = ibdata1:2048M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 0
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
innodb_log_group_home_dir = /data/mysqldata/3306/innodb_log
innodb_flush_log_at_trx_commit = 2
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 120
innodb_flush_method=O_DIRECT
[mysqldump]
quick
max_allowed_packet = 512M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with
#safe-updates
[myisamchk]
key_buffer_size = 32M
sort_buffer_size = 20M
read_buffer_size = 2M
write_buffer_size = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
启动数据库:
[root@mysqldb2 mysql]# mysqld_safe –defaults-file=/data/mysqldata/3306/my.cnf &
设置超级用户密码:
[root@mysqldb2 mysql]# mysqladmin -uroot password ’verysafe’ -S /data/mysqldata/3306/mysql.sock
使用mysql命令行连接:
[root@mysqldb2 mysql]# mysql -uroot -pverysafe -S /data/mysqldata/3306/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 271570
Server version: 5.1.51-junsansi-edition-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
done~~~
相关文章推荐
- mysql多实例,my.cnf 4G conf配置安装配置
- Mac安装MySQL、修改MySQL的初始化密码、默认字符集为utf-8以及配置完my.cnf的文件后仍不生效的情况下的处理方案
- linux下mysql的编译安装和my.cnf配置文件详解
- linux下安装mysql my.cnf配置文件发生错误
- MySql5.6Linux安装后my.cnf配置文件位置
- 三思—mysql安装配置手册(一)
- mac pro 安装mysql并且配置my.cnf(添加默认字符集utf8,数据存放路径,修改已经建好的表的默认字符集等)
- LINUX 环境下源码方式安装mysql(二)my.cnf配置细节详解
- Centos 通过yum默认安装mysql,my.cnf的常用配置
- MAC 安装MySQL my.cnf配置文件
- mac pro 安装mysql并且配置my.cnf(添加默认字符集utf8,数据存放路径,修改已经建好的表的默认字符集等)、mac mysql my.cnf路径
- MYSQL my.cnf 配置 163.com
- ubuntu12.04 修改mysql配置文件my.cnf编码出错---解决方法
- ubuntu mysql 配置文件my.cnf 更改tmp路径
- mysql 免安装,配置文件my.ini
- ubuntu mysql 启动命令/配置my.cnf
- MySQL配置文件my.cnf中文版
- mysql配置文件 /etc/my.cnf 详细解释
- MySQL配置文件my.cnf优化
- MySQL配置文件my.cnf中文详解附mysql性能优化方法分享