DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Common My.cnf File

10.20.2009
| 8623 views |
  • submit to reddit
        // standard my.cnf file that will work on any new server

# cat /etc/my.cnf
[mysqld]
datadir=/mysql
socket=/var/lib/mysql/mysql.sock
#user=root
server-id=50215
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

#skip-grant-tables

relay-log=/var/run/mysqld/mysqld-relay-bin

log_slow_queries=/var/log/mysql/mysql-slow.log
long_query_time=1
log_queries_not_using_indexes

#log-bin=/var/log/mysql/mysql-bin.log
#log=/var/log/mysql/mysql-gen.log
#max_binlog_size=1024M
#expire_logs_days=12
#sync_binlog=1

key_buffer=128M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=1M 
join_buffer_size=2M
bulk_insert_buffer_size=16M
thread_concurrency=4
thread_cache_size=150
table_cache=512

query_cache_size=500M
query_cache_type=1
query_cache_limit=1M

max_heap_table_size=64M
tmp_table_size=32M


#innodb setting
#innodb_data_file_path=ibdata1:2800M;ibdata2:2800M:autoextend
innodb_log_file_size=256M
innodb_buffer_pool_size=512M
innodb_additional_mem_pool_size=16M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=16M
innodb_flush_method=O_DIRECT


log_bin_trust_function_creators=TRUE
group_concat_max_len=500000
max_allowed_packet=100M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


    

Comments

Snippets Manager replied on Mon, 2012/05/07 - 3:14pm

If I keep the file my.cnf world writable (777), then I get an error Warning: World-writable config file '/etc/my.cnf' is ignored The solution is to change the mod to 770 and start mysqld as root. # ls my*.* -lht -rw-rw-rw- 1 root root 1.3K Nov 4 10:54 my.cnf -rw-r--r-- 1 root root 515 Oct 6 12:41 my_old.cnf # chmod 770 my.cnf # ls my*.* -lht -rwxrwx--- 1 root root 1.3K Nov 4 10:54 my.cnf -rw-r--r-- 1 root root 515 Oct 6 12:41 my_old.cnf # service mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ]