ID #1043

Can I change my database name(s)

 

NO ... and yes!

Directly changing database names is not possible! It is not a restriction with SQLyog, but with MySQL itself. The reason is that the database name exists not only in MySQL tables but as filenames in the file system as well. Changing both system tables and filenames is not without problems (not secure) in case of a server crash in between. You may be left with nothing then! So for security reasons a 'rename DB' is not available.

 

However, you can copy your database to a new one with a new name in different ways with SQLyog:


1) Make a backup with SQLyog and change the 'use' SQL-statement in the dump-file to new DB-name before importing.
2) Create a new empty database and "copy DB to other host" using SQLyog. Don't be confused - it works with two DBs on the same host as well! When it is done you can drop the old one.

But no matter how you do it involves copying all data, and it will take a lot of time with big DBs. And if you have ONE DB ONLY at a webhost (typical 'personal' subscription plan) you will need to backup, drop current DB, change 'use'-stmt and import. Be sure to use a 'Bulk Insert' setting that you know works with the server configuration. Probably it is safest NOT to use BULK INSERTS at all! Though that would increment the time for restore.

 

However 'rename database' is implemented in MySQL in the 5.1 tree. We do not support it and have not decided if we will ever do. The problem is that only DATA are kept with this command. Stored Procedures, Views, Triggers will be lost when using this command. There is a pending bug report on this and we will need to wait for the final implementation in MySQL, before we decide what we will do!

 

Tags: -

Related entries:

You can comment this FAQ