I suggest you...

rename database

Rename mysql database using dbforge studio

200 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    prakashprakash shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • gr8kodrgr8kodr commented  ·   ·  Flag as inappropriate

        [QUOTE] From the MySQL Manual
        RENAME DATABASE Syntax
        RENAME {DATABASE | SCHEMA} <db_name> TO <new_db_name>;

        This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23. It was intended to enable upgrading pre-5.1 databases to use the encoding implemented in 5.1 for mapping database names to database directory names. However, use of this statement could result in loss of database contents, which is why it was removed. Do not use RENAME DATABASE in earlier versions in which it is present.

        To perform the task of upgrading database names with the new encoding, use ALTER DATABASE <db_name> UPGRADE DATA DIRECTORY NAME instead
        [END QUOTE]

        In a round about manner, I was able to perform a Database rename (outlined below) within the IDE. However, for a large database with many tables, I can see that my technique is far from optimal ...

        1. Create new DB -> `database1`
        2. Add a couple of dummy tables (tbl1, tbl2)
        3. Create a new DB `database2`
        4. Duplicate the tables from database1 into database2 (individually)
        5. DROP `database1`

        I believe that PhpMyAdmin uses the recipe above to perform the same task with the modification that it allows you move all tables to into the new DB by selecting each table behind the scenes

      Feedback and Knowledge Base