This morning I needed to rename my database and found these three commands I’m going to show you:
mysqldump -u username -p -v olddatabase > olddbdump.sql mysqladmin -u username -p create newdatabase mysql -u username -p newdatabase < olddbdump.sql
[ source: stackoverflow.com ]