There are a couple ways to rename a MySQL database:

1. Using SQL query

You have to create a new database first:

CREATE database new_db;

Then rename all the tables from the current database to the new database:

RENAME TABLE old_db.table TO new_db;

Then drop the old database:

DROP database old_db;

2. Using shell command:

mysql -u username -ppassword old_db -sNe 'show tables' | while read table; \ 
    do mysql -u username -ppassword -sNe "rename table old_db.$table to new_db.$table"; done

3. Using TablePlus

Click on the database icon (or use shortcut key cmd + K), right click on the database name and choose Rename….

Rename MySQL Database

Then hit commit (Cmd + S) to save the change to the server.


New to TablePlus? It’s a modern, native tool with an elegant GUI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.


Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS.

TablePlus GUI Tool MySQL