您的位置:首页 > 数据库 > MySQL

三思—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~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 配置文件 local