MySQL database Alter database processing logic

Source: Internet
Author: User


The Alter database processing logic of MySQL database is not as terrible as Alter table, and the processing logic is clear. First, check whether the database name is effectively called check_db_name () (table. cc: 2876) to check whether the database name is valid, call check_table_name () (table. cc: 2904) function. The check_table_name function name is misleading. It is actually used to check whether the database name is legal. 2. Check whether you have the right to modify the check_access () (SQL _parse.cc: 4715) to check whether the database exists and whether the user has the permission to modify the database. Www.2cto.com 3. Call mysql_alter_db () (SQL _db.cc: 685) to modify the database. Call the lock_schema_name () (lock. cc: 767) function to obtain the mutex lock of the schema. Call the write_db_opt () (SQL _db.cc: 313) function to recreate the db. opt file. The content recorded in the db. opt file is the content of the default character set. Then write the binlog. The above analysis shows that the business logic of the Alter database operation is relatively simple, but the function is also relatively simple. The alter database option can only modify the default charset and default collation. Author king_wangheng

Related Article

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.