Search code examples
sqlphpmyadminrename

How to rename database using phpMyAdmin tool?


I created a fresh database in phpmyadmin which does not contain any tables yet since its fresh, however I accidentally made a typo. How can I rename the database?

If this happens to me I usually just execute the SQL command:

DROP DATABASE dbname;

and create another database. But is it possible to rename it? I was already searching SO but found nothing helpful.


Solution

  • I found two possible solutions.

    1. Rename it via the phpmyadmin backend UI (preferable):

    enter image description here

    enter image description here

    1. Or just execute this SQL (only use it if the database is fresh and does not contain any data yet, otherwise it will be lost!)

      CREATE DATABASE newname;

      DROP DATABASE oldname;