[MySQLFAQ] series-enable the newly installed MySQL in GTID & binlog

Source: Internet
Author: User
Q: In the newly installed MySQL, the following message is displayed. I cannot log on. What is the problem? [Root @ imysqlmysql] # mysqlmysqlERROR1045 (28000): Accessdeniedforuserroot @ localhost (usingpassword: NO) answer: the database has been initialized by mysql_install_db. It should be reasonable to say that there is NO problem.

Q: In the newly installed MySQL, the following message is displayed. I cannot log on. What is the problem? [Root @ imysql mysql] # mysql mysqlERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) answer: the database has been initialized by mysql_install_db. It should be okay.

Q: In the newly installed MySQL, the following message is displayed. I cannot log on. What is the problem?

[root@imysql mysql]# mysql mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

A: The database has been initialized by mysql_install_db. It should be okay. After investigation, we found that the permission mode of the $ datadir mysql database directory is:

drwx------ 2 mysql root        4096 Jan  9 20:22 mysql

It seems that there is no problem. Check the error log and find a row:

130109 21:04:23 [Warning] Bootstrap mode disables GTIDs. Bootstrap mode should only be used by mysql_install_db which initializes the MySQL data directory and creates system tables.ERROR: 1785  Updates to non-transactional tables are forbidden when DISABLE_GTID_UNSAFE_STATEMENTS = 1.130109 21:04:23 [ERROR] Aborting

In addition, the user tablespace file in the mysql database is displayed as follows:

-rw-rw---- 1 mysql mysql 10684 Jan  9 20:22 user.frm-rw-rw---- 1 mysql mysql     0 Jan  9 20:22 user.MYD-rw-rw---- 1 mysql mysql  1024 Jan  9 20:22 user.MYI

The size of the user tablespace data file is 0.
It seems that it has something to do with enabling GTID mode. After careful check, we found that GTID-related options are:

gtid_mode = ONbinlog_format = mixeddisable-gtid-unsafe-statements = 1log-bin=binlog

This is because when GTID mode is enabled, transaction consistency cannot be guaranteed when non-transaction tables are updated. Therefore, set disable-gtid-unsafe-statements = 1 to ensure master-slave data consistency.

Solution:
In this case, you can change the value of disable-gtid-unsafe-statements to 0. You can also disable the GTID and binlog options at the same time and enable them after initialization.

#gtid_mode = ON#log-bin=binlog

Or

disable-gtid-unsafe-statements = 0

Technical issues:

Basic MySQL knowledge

MySQL FAQ

Original article address: [MySQL FAQ] series-enable GTID & binlog newly installed MySQL prompts that you cannot log on. Thank you for sharing your thanks.

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.