Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: TIDB 修改数据库名有什么好方案
It cannot support the following statement like MySQL:
RENAME DATABASE esss_db.test_ins TO esss_test_db.test_ins
Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: TIDB 修改数据库名有什么好方案
It cannot support the following statement like MySQL:
RENAME DATABASE esss_db.test_ins TO esss_test_db.test_ins
Yes, RENAME table esss_db.test_ins TO esss_test_db.test_ins will do.
What is your scenario?
If renaming the database is not supported, see if there is an alternative solution.
Usually, it’s either renaming the table or exporting and importing.
This is not supported. You can only export all tables and then import them.
MySQL does not have a direct RENAME database operation; it needs to be resolved through data migration.
Just write a small script to batch rename tables, importing and exporting is too troublesome.
Renaming databases is safe, but it has been deprecated. Has anyone done batch renaming of tables in a production database? Will there be any unexpected issues?
Let’s start with read-only operations and avoid online writes for now.
Using third-party tools for batch import and export is convenient.
For the production environment, it is recommended to use import and export, and write a script offline to batch rename tables.