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.