![]() ![]() ![]() When referring to a table, we typically use the database name followed by a dot and the table name. Step 2: The next step is to rename the names of tables of the existing database. For that, you can execute the following statement.Įxplanation: where new_Name_Of_DB is the name of the new database. Step 1: The first step we need to perform is to create a new database with the name we want to rename the existing database. Let us see each of the methods in detail one by one: 1. Just close your MySQL server and then rename the directory of your database, i.e., the folder of the database then that will automatically lead to a changed database name with the changed directory name. If all the tables in your existing database are of type MyISAM, then you can use one trick. Write the script in case you use the Linux platform containing the code to get all the tables from the database and rename all the tables to the new database name. Rename all the old database tables to new database names and then drop the old database.ĭump the existing database to generate backup and restore the backup with a new name of the database. Below is a list of some of the methods that can be followed to rename the database in the latest versions of MySQL:Ĭreate a new database with the name you wish to change to the older database. However, this method is not supported in the latest versions of MySQL for security reasons. If your MYSQL version is older than MySQL 5.1.23, you can make use of the following commands:ĪLTER DATABASE existing_DB_name MODIFY NAME = name_Of_new_DB Methods of Renaming the Database Out of them, which method will be used depends on the context, like how big your database is, what type of tables are present in it, and so on. You can rename a database using several different methods. To rename a database safely and effectively, follow these instructions: How to Rename the Database? But this proved dangerous concerning security, so MySQL versions 5.1.23 and onwards removed the feature. The older versions of MySQL, versions before MySQL 5.1.23, had provided the simple method to rename the database using the RENAME DATABASE command. Now, you feel that the existing name of the database is not that relevant or meaningful as per the new context. This usually happens when the client side implements a project or when a new project needs to use the same database. ![]() The database administrator may need to modify the name of the database on a server in certain instances. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |