Renaming a database in mysql

Source: Internet
Author: User

Renaming a database in mysql is not an effort-saving task. If your MySQL version is 5.1.7 and earlier than 5.1.23, you can use RENAME {DATABASE | SCHEMA} db_name TO new_db_name. However, this method is not reliable, data may be lost, which is not recommended. Description of this official document (http://dev.mysql.com/doc/refman/5.1/en/rename-database.html): However, use of this statement cocould result in loss of database contents, which is why it was removed. do not use rename database in earlier versions in which it is present. this statement is not safe and cannot be used in Versions later than 5.1.23. In addition, there are some trade-offs. In general, we use mysqldump to export data, create a new database, import data, and drop the old database. Mysqladmin create spmmysqldump SPM | if you have phpmyadmin in mysql spm, you can click the "operation" tab. One item is "rename the Database", and 1000 words are omitted here. Ps: the MySQL official document mentions alter database db_name upgrade data directory name, which is used to solve the problem of displaying the database name after UPGRADE 5.0 and 5.1, and is not the same as renaming.

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.