Example InnoDB my.cnf file for high end GNU/Linux machines

Developed In: None/Text — Contributed by: François Schiettecatte

Example InnoDB my.cnf file for high end GNU/Linux machines


None/Text
  1. #----------------------------------------------------------------
  2. #
  3. # my.cnf file
  4. #
  5. #
  6.  
  7. # See:
  8. #
  9. # http://dev.mysql.com/doc/refman/5.1/en/server-options.html
  10. # http://dev.mysql.com/doc/refman/5.1/en/option-files.html
  11. #
  12.  
  13. # You can also dump all the variables set for mysqld with:
  14. #
  15. # mysqld --verbose --help
  16. #
  17.  
  18. #----------------------------------------------------------------
  19.  
  20. [client]
  21.  
  22. # These options apply to all client applications
  23.  
  24. # Port and the socket
  25. port = 3306
  26. socket = /tmp/mysqld.sock
  27. #password = my_password
  28.  
  29.  
  30. # Default character set to utf-8
  31. default_character_set = utf8
  32.  
  33.  
  34. #----------------------------------------------------------------
  35.  
  36. [safe_mysqld]
  37.  
  38. # Log file
  39. err_log = /home/poplar/mysql/logs/mysql.err
  40.  
  41.  
  42. #----------------------------------------------------------------
  43.  
  44. [mysqld]
  45.  
  46.  
  47. # Skip options
  48. #skip_bdb
  49. #skip_innodb
  50. skip_locking
  51. #skip_networking
  52.  
  53.  
  54.  
  55. # Server ID must be unique to allow for replication
  56. server_id = 9000
  57.  
  58. # User name to run as
  59. user = mysql
  60.  
  61. # Port and the socket
  62. port = 3306
  63. socket = /tmp/mysqld.sock
  64.  
  65. # Bind to a specific address, otherwise listen to all addresses
  66. #bind_address = 127.0.0.1
  67.  
  68.  
  69.  
  70. # Maximum number of connections
  71. max_connections = 2048
  72.  
  73. # Connection backlog, raise this if we run out of
  74. # connections (128 is the linux default)
  75. back_log = 128
  76.  
  77. # Maximum number of connection error per host
  78. max_connect_errors = 1000
  79.  
  80. # Connection timeout
  81. connect_timeout = 2
  82.  
  83. # Timeout for inactive connections
  84. wait_timeout = 60
  85.  
  86. # Maximum packet length, no single MySQL statement can be longer than this
  87. max_allowed_packet = 16M
  88.  
  89. # Network buffer length (I think this is the linux default)
  90. net_buffer_length = 8K
  91.  
  92.  
  93.  
  94. # Set the default character set to utf8
  95. default_character_set = utf8
  96.  
  97. # Set the server character set
  98. character_set_server = utf8
  99.  
  100. # Set the default collation to utf8_general_ci
  101. default_collation = utf8_general_ci
  102.  
  103. # Set the names to utf8 when a client connects
  104. init_connect = 'SET NAMES utf8; SET sql_mode = STRICT_TRANS_TABLES'
  105.  
  106.  
  107.  
  108. # Server directories
  109. basedir = /usr/local/mysql
  110. datadir = /home/poplar/mysql/data
  111. tmpdir = /home/poplar/mysql/tmp
  112.  
  113. # Language file location
  114. language = /usr/local/mysql/share/english
  115.  
  116. # Error log file (need dash in variable name)
  117. log-error = /home/poplar/mysql/logs/mysqld.err
  118.  
  119. # Process ID file (need dash in variable name)
  120. pid-file = /var/run/mysqld/mysqld.pid
  121.  
  122. # Log slow queries, time threshold set by 'long_query_time',
  123. log_slow_queries = /home/poplar/mysql/logs/slow-queries.log
  124. log_output = FILE # 5.1 only
  125. long_query_time = 5
  126.  
  127. # Log queries which don't use indices in the slow query log
  128. log_long_format
  129.  
  130. # Enable this to get a log of all the statements coming from a client,
  131. # this should be used for debugging only as it generates a lot of stuff
  132. # very quickly
  133. #log = /home/poplar/mysql/logs/queries.log
  134.  
  135. # Binary log and replication log file names prefix
  136. log_bin = /home/poplar/mysql/binary-logs/server1-bin
  137. relay_log = /home/poplar/mysql/binary-logs/server1-relay-bin
  138.  
  139. # Binary log format, see:
  140. # http://dev.mysql.com/doc/refman/5.1/en/replication-row-based.html
  141. # http://dev.mysql.com/doc/refman/5.1/en/replication-sbr-rbr.html
  142. binlog_format = row # 5.1 only
  143.  
  144. # Binary log cache size
  145. binlog_cache_size = 1M
  146.  
  147.  
  148.  
  149. # Skip automatic replication start up, replication will have to be
  150. # started manually with 'start slave' once the server is started
  151. skip_slave_start
  152.  
  153. # Make the slave read-only
  154. #read_only
  155.  
  156. # Select which replication errors to skip, see
  157. # http://dev.mysql.com/doc/refman/5.1/en/replication-options.html
  158. #slave_skip_errors = 1062
  159.  
  160. # Select which databases/tables to ignore during replication, see
  161. # http://dev.mysql.com/doc/refman/5.1/en/replication-options.html
  162. #replicate_ignore_db =
  163. #replicate_ignore_table =
  164. #replicate_do_db =
  165. #replicate_do_table =
  166.  
  167.  
  168.  
  169. # Number of open tables at any one time
  170. table_cache = 4096
  171.  
  172. # Join buffer size for index-less joins
  173. join_buffer_size = 8M
  174.  
  175. # Maximum size for in memory temporary tables, anything
  176. # larger gets spun out to disc
  177. tmp_table_size = 64M
  178.  
  179. # Sort buffer size for ORDER BY and GROUP BY queries, data
  180. # gets spun out to disc if it does not fit
  181. sort_buffer_size = 8M
  182.  
  183.  
  184.  
  185. # Thread cache size, concurrency and stack
  186. thread_cache_size = 64
  187. thread_concurrency = 8
  188. thread_stack = 192K
  189.  
  190.  
  191.  
  192. # Query cache, disabled for now
  193. query_cache_size = 0
  194. query_cache_type = 1
  195. query_cache_limit = 2M
  196.  
  197.  
  198.  
  199. # Default table storage engine when creating new tables
  200. # (comment out when running mysql_install_db)
  201. default_storage_engine = InnoDB
  202.  
  203.  
  204. # Default transaction isolation level, levels available are:
  205. # READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
  206. # see: http://dev.mysql.com/doc/refman/5.1/en/set-transaction.html
  207. transaction_isolation = REPEATABLE-READ
  208.  
  209.  
  210.  
  211. # MyISAM options, see:
  212. # http://dev.mysql.com/doc/refman/5.1/en/myisam-start.html
  213. key_buffer_size = 256M
  214. read_buffer_size = 2M
  215. read_rnd_buffer_size = 8M
  216. myisam_sort_buffer_size = 128M
  217. bulk_insert_buffer_size = 64M
  218. myisam_max_sort_file_size = 10G
  219. myisam_repair_threads = 2
  220. #myisam_recover_options = DEFAULT
  221.  
  222.  
  223.  
  224. # InnoDB options, see:
  225. # http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html
  226.  
  227.  
  228. # Data directory, and data file
  229. innodb_data_home_dir = /home/poplar/mysql/data
  230. innodb_data_file_path = ibdata1:10M:autoextend
  231.  
  232. # Use one file per table
  233. innodb_file_per_table
  234.  
  235. # Buffer pool size
  236. innodb_buffer_pool_size = 2G # 4GB RAM
  237. #innodb_buffer_pool_size = 10G # 16GB RAM
  238. innodb_additional_mem_pool_size = 32M
  239.  
  240. # Transaction log location and sizes
  241. innodb_log_group_home_dir = /home/poplar/mysql/innodb-logs
  242. innodb_log_files_in_group = 4
  243. innodb_log_file_size = 128M # 4GB RAM
  244. #innodb_log_file_size = 512M # 16GB RAM
  245. innodb_log_buffer_size = 8M
  246.  
  247. # Percentage of unwritten dirty pages not to exceed
  248. innodb_max_dirty_pages_pct = 80
  249.  
  250. # Transaction commit policy
  251. innodb_flush_log_at_trx_commit = 1
  252.  
  253. # Timeout to wait for a lock before rolling back a transaction
  254. innodb_lock_wait_timeout = 50
  255.  
  256. # Flush method
  257. innodb_flush_method = O_DIRECT
  258.  
  259. # Number of concurrent threads to run
  260. innodb_thread_concurrency = 32
  261.  
  262. # Autoinc lock mode ('consecutive' lock mode), see:
  263. # http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html
  264. innodb_autoinc_lock_mode = 1
  265.  
  266. # Prevent extra locking, we can only use this if we have row
  267. # level replication, see 'binlog_format'
  268. innodb_locks_unsafe_for_binlog # 5.1 only
  269.  
  270. # Enable fast innodb shutdown (skip full purge and insert buffer merge)
  271. innodb_fast_shutdown = 1
  272. #innodb_fast_shutdown = 0
  273.  
  274. # Dont delay insert, update and delete operations when purge
  275. # operations are lagging
  276. innodb_max_purge_lag = 0
  277. #innodb_max_purge_lag = 1
  278.  
  279. # Force recovery mode, do not mess with unless you really know
  280. # what you are doing, see:
  281. # http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
  282. #innodb_force_recovery = 4
  283.  
  284.  
  285. #----------------------------------------------------------------
  286.  
  287. [mysqldump]
  288.  
  289. # Enable quick dumping
  290. quick
  291.  
  292. # Set the max allowed packet size
  293. max_allowed_packet = 16M
  294.  
  295.  
  296. #----------------------------------------------------------------
  297.  
  298. [mysql]
  299.  
  300. # Disable tab completion in mysql
  301. #no_auto_rehash
  302.  
  303.  
  304. #----------------------------------------------------------------
  305.  
  306. [myisamchk]
  307.  
  308. # Set the buffer sizes used by myisamchk when checking/rebuilding
  309. # databases
  310. key_buffer = 256M
  311. sort_buffer = 256M
  312. read_buffer = 64M
  313. write_buffer = 64M
  314.  
  315.  
  316. #----------------------------------------------------------------
  317.  
  318. [mysqlhotcopy]
  319.  
  320. # No clue
  321. interactive_timeout
  322.  
  323.  
  324. #----------------------------------------------------------------
  325.  
  326.  

Current Tags

utf8  mycnf 

You must be logged in to tag this tool

I use it on Linux currently so it does work.

Votes

Not yet rated.
You must be logged in to vote.

Watches

0 members are watching this tool
You must be logged in to track this tool.

Provide Feedback

Please note:
HTML will be purified, but we allow for a number of HTML tags so that you have the flexibility to decorate your comment text to some extent. The comments allow the following HTML tags:

strong, b, em, blockquote, a, code, pre

To put code into your comment, simply encapsulate your code with
[code language="XXX"][/code], where XXX is any common language, for instance "PHP", "SQL", "C", etc.



You must be logged in to comment