Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use ALTER DATABASE to rename a mysql database?

I am using PDO with PHP to create a new database and then a new user with privileges on that database. In case one of them fails, I want to rename the database and user so that they can be deleted later and the names are available.

Is it possible to rename a mysql database using the ALTER DATABASE?

like image 372
Xerri Avatar asked Apr 14 '10 13:04

Xerri


1 Answers

Duplicate -- see How do I quickly rename a mysql database (change schema name)

In short, no. MySQL doesn't have a quick/simple way to rename databases. You have to use mysqladmin and mysqldump from the command line. See question above for all the details.

like image 110
Chris J Avatar answered Sep 21 '22 18:09

Chris J