MySQL Configuration optimization

Source: Internet
Author: User

MySQL optimization

' %innodb_flush_log_at_trx_commit% ' ; +--------------------------------+-------+| Variable_name                  1     |+--------------------------------+-------+1inset (0.00 sec)

There are three types of default 1 for this value (optional 2 and 0)

Set GLOBAL innodb_flush_log_at_trx_commit=0;

The default value of 1 means that every single transaction commit or out-of-transaction instruction requires the log to be written to (flush) the hard disk, which is time consuming. Especially when using the battery-powered cache (Battery backed up cache). Set to 2 for many applications, especially from the MyISAM table is possible, it means to write to the system cache instead of writing to the hard disk. The log will still flush to the hard drive every second, so you will generally not lose more than 1-2 seconds of updates. Set to 0 will be faster, but the security side is poor, even if MySQL hangs may also lose the transaction data. A value of 2 will only lose data if the entire operating system is hung.

"General Change to 2"

----------------------------------------------------------------------

SELECT @ @GLOBAL. Sql_mode;

If you need to automatically truncate too long data when the database is inserted into the update, use the following

SET @ @GLOBAL. sql_mode="strict_trans_tables";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.