I have an existing database, named dlti.sql

I want to transfer it to a Linux-based server. I tried using this code, however I get no response:

mysql -u root -p Desktop < dlti.sql

The .sql file is located at the desktop.

Can anyone help me with this?

  • What is the working directory that you're running this from (i.e. what is the output of pwd? Also, where is MySQL running... on the local machine, or on a remote? – Thomas Kelley Nov 5 '13 at 3:50
  • I think you need to create the database first and then import the db – andypp Nov 5 '13 at 3:51
  • I'm doing this on the local machine. After I enter the code all I get is' -->' and that's it. – maecy m Nov 5 '13 at 3:53

You have to add the target database name.

$mysql -u root -p -h localhost

mysql> create database foo;
mysql> exit;

$mysql -u username -p -h localhost DATA-BASE-NAME < data.sql 

Just did a quick google search. Have you tried this? Open up your database in phpMyAdmin and then select Export from the menu. Scroll down and select the Save as file checkbox and then press Go.

Now open up the database in phpMyAdmin on the remote server (Note: you will need to create the database first) and then select Import from the menu. Browse to the file you saved and press Go.

If everything goes well you should now have a mirror image of your database on the remote server.

REFERENCE: https://stackoverflow.com/questions/2113768/how-to-move-local-mysql-db-up-to-remote-db-server

  • I have created the database, how do I import my database now? – maecy m Nov 5 '13 at 4:10
  • I'm guessing you have to install this: phpmyadmin.net/home_page/index.php ...Once you have this installed, you access it on your local host and export it. Then you install it on your remote host and import the file that you exported, onto your remote host. You can try a demo of it out as well online before downloading. – dunce1 Nov 5 '13 at 4:31
  • Also, you should be able to access it on your local host by going to your http://(whatever your localhost IP is)/phpmyadmin. If you have trouble accessing this, I suggest you look here: stackoverflow.com/questions/10111455/… – dunce1 Nov 5 '13 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy