Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Show all

Help Center/ TaurusDB/ Troubleshooting/ Basic Issues/ Renaming Databases and Tables

Renaming Databases and Tables

Updated on 2023-10-19 GMT+08:00

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;
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback