MySQL does not natively rename databases. When cPanel & WHM "renames" a database, the system performs the following steps:
- The system creates a new database.
- The system moves data from the old database to the new database.
- The system recreates grants and stored code in the new database.
- The system deletes the old database and its grants.
- If any of the first three steps fail, the system returns an error and attempts to restore the database's original state. If the restoration process fails, the function's error message will include the additional failures.
- In rare cases, the system creates the new database successfully, but fails to complete step 4. The system treats this as a success, but the function will return warning messages that describe the failure.