Guest User

Untitled

a guest
Jun 19th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.39 KB | None | 0 0
  1. # This is a MySQL example config file for systems with 4GB of memory
  2. # running mostly MySQL using InnoDB only tables and performing complex
  3. # queries with few connections.
  4. #
  5. # You can copy this file to /etc/my.cnf to set global options,
  6. # mysql-data-dir/my.cnf to set server-specific options
  7. # (/usr/local/mysql/data for this installation) or to
  8. # ~/.my.cnf to set user-specific options.
  9. #
  10. # In this file, you can use all long options that a program supports.
  11. # If you want to know which options a program supports, run the program
  12. # with the "--help" option.
  13. #
  14. # More detailed information about the individual options can also be
  15. # found in the manual.
  16. #
  17.  
  18. #
  19. # The following options will be read by MySQL client applications.
  20. # Note that only client applications shipped by MySQL are guaranteed
  21. # to read this section. If you want your own MySQL client program to
  22. # honor these values, you need to specify it as an option during the
  23. # MySQL client library initialization.
  24. #
  25. [client]
  26. #password = [your_password]
  27. port = 3306
  28. socket = /tmp/mysql.sock
  29.  
  30. # *** Application-specific options follow here ***
  31.  
  32. #
  33. # The MySQL server
  34. #
  35. [mysqld]
  36.  
  37. # generic configuration options
  38. port = 3306
  39. socket = /tmp/mysql.sock
  40.  
  41. # back_log is the number of connections the operating system can keep in
  42. # the listen queue, before the MySQL connection manager thread has
  43. # processed them. If you have a very high connection rate and experience
  44. # "connection refused" errors, you might need to increase this value.
  45. # Check your OS documentation for the maximum value of this parameter.
  46. # Attempting to set back_log higher than your operating system limit
  47. # will have no effect.
  48. back_log = 50
  49.  
  50. # Don't listen on a TCP/IP port at all. This can be a security
  51. # enhancement, if all processes that need to connect to mysqld run
  52. # on the same host. All interaction with mysqld must be made via Unix
  53. # sockets or named pipes.
  54. # Note that using this option without enabling named pipes on Windows
  55. # (via the "enable-named-pipe" option) will render mysqld useless!
  56. #skip-networking
  57.  
  58. # The maximum amount of concurrent sessions the MySQL server will
  59. # allow. One of these connections will be reserved for a user with
  60. # SUPER privileges to allow the administrator to login even if the
  61. # connection limit has been reached.
  62. max_connections = 100
  63.  
  64. # Maximum amount of errors allowed per host. If this limit is reached,
  65. # the host will be blocked from connecting to the MySQL server until
  66. # "FLUSH HOSTS" has been run or the server was restarted. Invalid
  67. # passwords and other errors during the connect phase result in
  68. # increasing this value. See the "Aborted_connects" status variable for
  69. # global counter.
  70. max_connect_errors = 10
  71.  
  72. # The number of open tables for all threads. Increasing this value
  73. # increases the number of file descriptors that mysqld requires.
  74. # Therefore you have to make sure to set the amount of open files
  75. # allowed to at least 4096 in the variable "open-files-limit" in
  76. # section [mysqld_safe]
  77. table_cache = 2048
  78.  
  79. # Enable external file level locking. Enabled file locking will have a
  80. # negative impact on performance, so only use it in case you have
  81. # multiple database instances running on the same files (note some
  82. # restrictions still apply!) or if you use other software relying on
  83. # locking MyISAM tables on file level.
  84. #external-locking
  85.  
  86. # The maximum size of a query packet the server can handle as well as
  87. # maximum query size server can process (Important when working with
  88. # large BLOBs). enlarged dynamically, for each connection.
  89. max_allowed_packet = 16M
  90.  
  91. # The size of the cache to hold the SQL statements for the binary log
  92. # during a transaction. If you often use big, multi-statement
  93. # transactions you can increase this value to get more performance. All
  94. # statements from transactions are buffered in the binary log cache and
  95. # are being written to the binary log at once after the COMMIT. If the
  96. # transaction is larger than this value, temporary file on disk is used
  97. # instead. This buffer is allocated per connection on first update
  98. # statement in transaction
  99. binlog_cache_size = 1M
  100.  
  101. # Maximum allowed size for a single HEAP (in memory) table. This option
  102. # is a protection against the accidential creation of a very large HEAP
  103. # table which could otherwise use up all memory resources.
  104. max_heap_table_size = 64M
  105.  
  106. # Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
  107. # queries. If sorted data does not fit into the sort buffer, a disk
  108. # based merge sort is used instead - See the "Sort_merge_passes"
  109. # status variable. Allocated per thread if sort is needed.
  110. sort_buffer_size = 8M
  111.  
  112. # This buffer is used for the optimization of full JOINs (JOINs without
  113. # indexes). Such JOINs are very bad for performance in most cases
  114. # anyway, but setting this variable to a large value reduces the
  115. # performance impact. See the "Select_full_join" status variable for a
  116. # count of full JOINs. Allocated per thread if full join is found
  117. join_buffer_size = 8M
  118.  
  119. # How many threads we should keep in a cache for reuse. When a client
  120. # disconnects, the client's threads are put in the cache if there aren't
  121. # more than thread_cache_size threads from before. This greatly reduces
  122. # the amount of thread creations needed if you have a lot of new
  123. # connections. (Normally this doesn't give a notable performance
  124. # improvement if you have a good thread implementation.)
  125. thread_cache_size = 8
  126.  
  127. # This permits the application to give the threads system a hint for the
  128. # desired number of threads that should be run at the same time. This
  129. # value only makes sense on systems that support the thread_concurrency()
  130. # function call (Sun Solaris, for example).
  131. # You should try [number of CPUs]*(2..4) for thread_concurrency
  132. thread_concurrency = 8
  133.  
  134. # Query cache is used to cache SELECT results and later return them
  135. # without actual executing the same query once again. Having the query
  136. # cache enabled may result in significant speed improvements, if your
  137. # have a lot of identical queries and rarely changing tables. See the
  138. # "Qcache_lowmem_prunes" status variable to check if the current value
  139. # is high enough for your load.
  140. # Note: In case your tables change very often or if your queries are
  141. # textually different every time, the query cache may result in a
  142. # slowdown instead of a performance improvement.
  143. query_cache_size = 64M
  144. #query_cache_size= 0
  145.  
  146. # Only cache result sets that are smaller than this limit. This is to
  147. # protect the query cache of a very large result set overwriting all
  148. # other query results.
  149. query_cache_limit = 2M
  150. #query_cache_limit=0
  151.  
  152. # Minimum word length to be indexed by the full text search index.
  153. # You might wish to decrease it if you need to search for shorter words.
  154. # Note that you need to rebuild your FULLTEXT index, after you have
  155. # modified this value.
  156. ft_min_word_len = 4
  157.  
  158. # If your system supports the memlock() function call, you might want to
  159. # enable this option while running MySQL to keep it locked in memory and
  160. # to avoid potential swapping out in case of high memory pressure. Good
  161. # for performance.
  162. #memlock
  163.  
  164. # Table type which is used by default when creating new tables, if not
  165. # specified differently during the CREATE TABLE statement.
  166. default_table_type = MYISAM
  167.  
  168. # Thread stack size to use. This amount of memory is always reserved at
  169. # connection time. MySQL itself usually needs no more than 64K of
  170. # memory, while if you use your own stack hungry UDF functions or your
  171. # OS requires more stack for some operations, you might need to set this
  172. # to a higher value.
  173. thread_stack = 192K
  174.  
  175. # Set the default transaction isolation level. Levels available are:
  176. # READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
  177. transaction_isolation = REPEATABLE-READ
  178.  
  179. # Maximum size for internal (in-memory) temporary tables. If a table
  180. # grows larger than this value, it is automatically converted to disk
  181. # based table This limitation is for a single table. There can be many
  182. # of them.
  183. tmp_table_size = 64M
  184.  
  185. # Enable binary logging. This is required for acting as a MASTER in a
  186. # replication configuration. You also need the binary log if you need
  187. # the ability to do point in time recovery from your latest backup.
  188. # log-bin=mysql-bin
  189.  
  190. # If you're using replication with chained slaves (A->B->C), you need to
  191. # enable this option on server B. It enables logging of updates done by
  192. # the slave thread into the slave's binary log.
  193. #log_slave_updates
  194.  
  195. # Enable the full query log. Every query (even ones with incorrect
  196. # syntax) that the server receives will be logged. This is useful for
  197. # debugging, it is usually disabled in production use.
  198. #log
  199.  
  200. # Print warnings to the error log file. If you have any problem with
  201. # MySQL you should enable logging of warnings and examine the error log
  202. # for possible explanations.
  203. #log_warnings
  204.  
  205. # Log slow queries. Slow queries are queries which take more than the
  206. # amount of time defined in "long_query_time" or which do not use
  207. # indexes well, if log_long_format is enabled. It is normally good idea
  208. # to have this turned on if you frequently add new queries to the
  209. # system.
  210. log_slow_queries
  211.  
  212. # All queries taking more than this amount of time (in seconds) will be
  213. # trated as slow. Do not use "1" as a value here, as this will result in
  214. # even very fast queries being logged from time to time (as MySQL
  215. # currently measures time with second accuracy only).
  216. long_query_time = 2
  217.  
  218. # Log more information in the slow query log. Normally it is good to
  219. # have this turned on. This will enable logging of queries that are not
  220. # using indexes in addition to long running queries.
  221. log_long_format
  222.  
  223. # The directory used by MySQL for storing temporary files. For example,
  224. # it is used to perform disk based large sorts, as well as for internal
  225. # and explicit temporary tables. It might be good to put it on a
  226. # swapfs/tmpfs filesystem, if you do not create very large temporary
  227. # files. Alternatively you can put it on dedicated disk. You can
  228. # specify multiple paths here by separating them by ";" - they will then
  229. # be used in a round-robin fashion.
  230. #tmpdir = /tmp
  231.  
  232.  
  233. # *** Replication related settings
  234.  
  235.  
  236. # Unique server identification number between 1 and 2^32-1. This value
  237. # is required for both master and slave hosts. It defaults to 1 if
  238. # "master-host" is not set, but will MySQL will not function as a master
  239. # if it is omitted.
  240. # server-id = 1
  241.  
  242. # Replication Slave (comment out master section to use this)
  243. #
  244. # To configure this host as a replication slave, you can choose between
  245. # two methods :
  246. #
  247. # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
  248. # the syntax is:
  249. #
  250. # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
  251. # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
  252. #
  253. # where you replace <host>, <user>, <password> by quoted strings and
  254. # <port> by the master's port number (3306 by default).
  255. #
  256. # Example:
  257. #
  258. # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
  259. # MASTER_USER='joe', MASTER_PASSWORD='secret';
  260. #
  261. # OR
  262. #
  263. # 2) Set the variables below. However, in case you choose this method, then
  264. # start replication for the first time (even unsuccessfully, for example
  265. # if you mistyped the password in master-password and the slave fails to
  266. # connect), the slave will create a master.info file, and any later
  267. # changes in this file to the variable values below will be ignored and
  268. # overridden by the content of the master.info file, unless you shutdown
  269. # the slave server, delete master.info and restart the slaver server.
  270. # For that reason, you may want to leave the lines below untouched
  271. # (commented) and instead use CHANGE MASTER TO (see above)
  272. #
  273. # required unique id between 2 and 2^32 - 1
  274. # (and different from the master)
  275. # defaults to 2 if master-host is set
  276. # but will not function as a slave if omitted
  277. #server-id = 2
  278. #
  279. # The replication master for this slave - required
  280. #master-host = <hostname>
  281. #
  282. # The username the slave will use for authentication when connecting
  283. # to the master - required
  284. #master-user = <username>
  285. #
  286. # The password the slave will authenticate with when connecting to
  287. # the master - required
  288. #master-password = <password>
  289. #
  290. # The port the master is listening on.
  291. # optional - defaults to 3306
  292. #master-port = <port>
  293.  
  294. # Make the slave read-only. Only users with the SUPER privilege and the
  295. # replication slave thread will be able to modify data on it. You can
  296. # use this to ensure that no applications will accidently modify data on
  297. # the slave instead of the master
  298. #read_only
  299.  
  300.  
  301. #*** MyISAM Specific options
  302.  
  303.  
  304. # Size of the Key Buffer, used to cache index blocks for MyISAM tables.
  305. # Do not set it larger than 30% of your available memory, as some memory
  306. # is also required by the OS to cache rows. Even if you're not using
  307. # MyISAM tables, you should still set it to 8-64M as it will also be
  308. # used for internal temporary disk tables.
  309. key_buffer_size = 32M
  310.  
  311. # Size of the buffer used for doing full table scans of MyISAM tables.
  312. # Allocated per thread, if a full scan is needed.
  313. read_buffer_size = 2M
  314.  
  315. # When reading rows in sorted order after a sort, the rows are read
  316. # through this buffer to avoid disk seeks. You can improve ORDER BY
  317. # performance a lot, if set this to a high value.
  318. # Allocated per thread, when needed.
  319. read_rnd_buffer_size = 16M
  320.  
  321. # MyISAM uses special tree-like cache to make bulk inserts (that is,
  322. # INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
  323. # INFILE) faster. This variable limits the size of the cache tree in
  324. # bytes per thread. Setting it to 0 will disable this optimisation. Do
  325. # not set it larger than "key_buffer_size" for optimal performance.
  326. # This buffer is allocated when a bulk insert is detected.
  327. bulk_insert_buffer_size = 64M
  328.  
  329. # This buffer is allocated when MySQL needs to rebuild the index in
  330. # REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
  331. # into an empty table. It is allocated per thread so be careful with
  332. # large settings.
  333. myisam_sort_buffer_size = 128M
  334.  
  335. # The maximum size of the temporary file MySQL is allowed to use while
  336. # recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
  337. # If the file-size would be bigger than this, the index will be created
  338. # through the key cache (which is slower).
  339. myisam_max_sort_file_size = 10G
  340.  
  341. # If the temporary file used for fast index creation would be bigger
  342. # than using the key cache by the amount specified here, then prefer the
  343. # key cache method. This is mainly used to force long character keys in
  344. # large tables to use the slower key cache method to create the index.
  345. myisam_max_extra_sort_file_size = 10G
  346.  
  347. # If a table has more than one index, MyISAM can use more than one
  348. # thread to repair them by sorting in parallel. This makes sense if you
  349. # have multiple CPUs and plenty of memory.
  350. myisam_repair_threads = 1
  351.  
  352. # Automatically check and repair not properly closed MyISAM tables.
  353. myisam_recover
  354.  
  355.  
  356. # Disable Federated by default
  357. #skip-federated
  358.  
  359. # *** BDB Specific options ***
  360.  
  361. # Use this option if you run a MySQL server with BDB support enabled but
  362. # you do not plan to use it. This will save memory and may speed up some
  363. # things.
  364. skip-bdb
  365.  
  366.  
  367. # *** INNODB Specific options ***
  368.  
  369. # Use this option if you have a MySQL server with InnoDB support enabled
  370. # but you do not plan to use it. This will save memory and disk space
  371. # and speed up some things.
  372. #skip-innodb
  373.  
  374. # Additional memory pool that is used by InnoDB to store metadata
  375. # information. If InnoDB requires more memory for this purpose it will
  376. # start to allocate it from the OS. As this is fast enough on most
  377. # recent operating systems, you normally do not need to change this
  378. # value. SHOW INNODB STATUS will display the current amount used.
  379. innodb_additional_mem_pool_size = 16M
  380.  
  381. # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
  382. # row data. The bigger you set this the less disk I/O is needed to
  383. # access data in tables. On a dedicated database server you may set this
  384. # parameter up to 80% of the machine physical memory size. Do not set it
  385. # too large, though, because competition of the physical memory may
  386. # cause paging in the operating system. Note that on 32bit systems you
  387. # might be limited to 2-3.5G of user level memory per process, so do not
  388. # set it too high.
  389. innodb_buffer_pool_size = 1G
  390.  
  391. # InnoDB stores data in one or more data files forming the tablespace.
  392. # If you have a single logical drive for your data, a single
  393. # autoextending file would be good enough. In other cases, a single file
  394. # per device is often a good choice. You can configure InnoDB to use raw
  395. # disk partitions as well - please refer to the manual for more info
  396. # about this.
  397. innodb_data_file_path = ibdata1:10M:autoextend
  398.  
  399. # Set this option if you would like the InnoDB tablespace files to be
  400. # stored in another location. By default this is the MySQL datadir.
  401. #innodb_data_home_dir = <directory>
  402.  
  403. # Number of IO threads to use for async IO operations. This value is
  404. # hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
  405. # larger number.
  406. innodb_file_io_threads = 4
  407.  
  408. # If you run into InnoDB tablespace corruption, setting this to a nonzero
  409. # value will likely help you to dump your tables. Start from value 1 and
  410. # increase it until you're able to dump the table successfully.
  411. #innodb_force_recovery=1
  412.  
  413. # Number of threads allowed inside the InnoDB kernel. The optimal value
  414. # depends highly on the application, hardware as well as the OS
  415. # scheduler properties. A too high value may lead to thread thrashing.
  416. innodb_thread_concurrency = 16
  417.  
  418. # If set to 1, InnoDB will flush (fsync) the transaction logs to the
  419. # disk at each commit, which offers full ACID behavior. If you are
  420. # willing to compromise this safety, and you are running small
  421. # transactions, you may set this to 0 or 2 to reduce disk I/O to the
  422. # logs. Value 0 means that the log is only written to the log file and
  423. # the log file flushed to disk approximately once per second. Value 2
  424. # means the log is written to the log file at each commit, but the log
  425. # file is only flushed to disk approximately once per second.
  426. innodb_flush_log_at_trx_commit = 1
  427.  
  428. # Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
  429. # and insert buffer merge on shutdown. It may increase shutdown time a
  430. # lot, but InnoDB will have to do it on the next startup instead.
  431. #innodb_fast_shutdown
  432.  
  433. # The size of the buffer InnoDB uses for buffering log data. As soon as
  434. # it is full, InnoDB will have to flush it to disk. As it is flushed
  435. # once per second anyway, it does not make sense to have it very large
  436. # (even with long transactions).
  437. innodb_log_buffer_size = 8M
  438.  
  439. # Size of each log file in a log group. You should set the combined size
  440. # of log files to about 25%-100% of your buffer pool size to avoid
  441. # unneeded buffer pool flush activity on log file overwrite. However,
  442. # note that a larger logfile size will increase the time needed for the
  443. # recovery process.
  444. innodb_log_file_size = 256M
  445.  
  446. # Total number of files in the log group. A value of 2-3 is usually good
  447. # enough.
  448. innodb_log_files_in_group = 3
  449.  
  450. # Location of the InnoDB log files. Default is the MySQL datadir. You
  451. # may wish to point it to a dedicated hard drive or a RAID1 volume for
  452. # improved performance
  453. #innodb_log_group_home_dir
  454.  
  455. # Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
  456. # If it is reached, InnoDB will start flushing them out agressively to
  457. # not run out of clean pages at all. This is a soft limit, not
  458. # guaranteed to be held.
  459. innodb_max_dirty_pages_pct = 90
  460.  
  461. # The flush method InnoDB will use for Log. The tablespace always uses
  462. # doublewrite flush logic. The default value is "fdatasync", another
  463. # option is "O_DSYNC".
  464. #innodb_flush_method=O_DSYNC
  465.  
  466. # How long an InnoDB transaction should wait for a lock to be granted
  467. # before being rolled back. InnoDB automatically detects transaction
  468. # deadlocks in its own lock table and rolls back the transaction. If you
  469. # use the LOCK TABLES command, or other transaction-safe storage engines
  470. # than InnoDB in the same transaction, then a deadlock may arise which
  471. # InnoDB cannot notice. In cases like this the timeout is useful to
  472. # resolve the situation.
  473. innodb_lock_wait_timeout = 120
  474.  
  475.  
  476. [mysqldump]
  477. # Do not buffer the whole result set in memory before writing it to
  478. # file. Required for dumping very large tables
  479. quick
  480.  
  481. max_allowed_packet = 16M
  482.  
  483. [mysql]
  484. no-auto-rehash
  485.  
  486. # Only allow UPDATEs and DELETEs that use keys.
  487. #safe-updates
  488.  
  489. [isamchk]
  490. key_buffer = 512M
  491. sort_buffer_size = 512M
  492. read_buffer = 8M
  493. write_buffer = 8M
  494.  
  495. [myisamchk]
  496. key_buffer = 512M
  497. sort_buffer_size = 512M
  498. read_buffer = 8M
  499. write_buffer = 8M
  500.  
  501. [mysqlhotcopy]
  502. interactive-timeout
  503.  
  504. [mysqld_safe]
  505. # Increase the amount of open files allowed per process. Warning: Make
  506. # sure you have set the global system limit high enough! The high value
  507. # is required for a large number of opened tables
  508. open-files-limit = 8192
Add Comment
Please, Sign In to add comment