Updated on 2024-09-05 GMT+08:00
Renaming Databases and Tables
GaussDB(for MySQL) uses the MySQL Community Edition to rename databases and tables.
- Renaming table names: Run the rename table a to b; statement. You can rename a table to move a table from one database to another. For example, rename table da.ta to db.ta moves the table ta from the database da to the database db.
- Renaming database names: Use the rename table command to move all tables from the original database to a new database, and then delete the original database. Example:
# Access the original database. use ta; # Show all table names in the original database. Show tables; # View the CREATE DATABASE statement in the original database. Show create database ta; # Use the CREATE DATABASE statement in the original database to create a new database. (Change only the database name.) create database tb; # Move all tables from the original database to the new database. rename table da.ta to db.ta; rename table da.tb to db.tb; rename table da.tc to db.tc; ... # Delete the original database. Drop database ta;
Parent topic: Basic Issues
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot