MySQL official documentation mentions ALTERDATABASEdb_nameUPGRADEDATADIRECTORYNAME, which is used to display the database name after upgrade of version 5.0 and version 5.1.
The MySQL official document mentions alter database db_name upgrade data directory name, which is used to display the database name after UPGRADE 5.0 and 5.1.
It is not a labor-saving task. If your MySQL version is 5.1.7 and earlier than 5.1.23, you can use the following simple method:
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
However, this method is not reliable and may cause data loss. It is not recommended. Description of this official document ():
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 spm
Mysqldump SPM | mysql spm
If you have phpmyadmin, you can click the "operation" tab, which is "rename the Database", with 1000 words 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.