Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a mySQL database without creating a new one

Tags:

mysql

I'm trying to import a mySQL database into a clients hosting where privelidges in PHP Admin are extremely limited.

I am not able to create a new database, only work with the one they've given me.

When I upload the file with the database details in it.. I get an error telling me that the database already exists.

When I try and upload the database with the details for a new one... I get the error message that I am not allowed to create a new database.

What can I do to upload the contents of this database to the new one?

like image 954
Adam Scot Avatar asked Oct 09 '12 20:10

Adam Scot


People also ask

How do I import a database into MySQL?

Importing a database from a fileFill in the fields with the connection information. Once connected to the database go to Data Import/Restore. Choose the option Import from Self-Contained File and select the file. Choose the destination database in Default Schema to be Imported To and then click on Start Import.

How do I create a sequel to my database?

Open the MySQL Workbench as an administrator (Right-click, Run as Admin). Click on File>Create Schema to create the database schema. Enter a name for the schema and click Apply. In the Apply SQL Script to Database window, click Apply to run the SQL command that creates the schema.


1 Answers

Edit your SQL dump file and get rid of the database create statement (and the drop database as well if one is there). Then import.

like image 53
Ray Avatar answered Sep 23 '22 09:09

Ray