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