Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting and Restoring MySQL Schema in Windows/ Workbench

I am trying to restore a mysql database / schema, complete with data, to a new, empty database (on the same machine).

Going through the 'Manage Import / Export' menu option in 'workbench' lets me export and restore fine, except I cannot specify a new name for the new database / schema.

Can anyone point out anything Im missing?

The only workaround I can think of is to manually do a search and replace on the '.sql' file it created.

Thanks.

like image 906
maxp Avatar asked Nov 30 '25 23:11

maxp


1 Answers

Have you considered using mysqldump to export your files from the command line and then mysqladmin to create a new database?

mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql
like image 171
bheussler Avatar answered Dec 04 '25 01:12

bheussler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!