Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a Mac I open the Terminal and type this command to connect to a remote database:

/Applications/MAMP/Library/bin/mysql -h hostDb -u userDb -p nameDb

I get the connection and then I need to add a table loading a .sql file located in my computer.

I'm already connected to the remote database but what is the command to load mySql.sql ? The file path is /Documents/mySql.sql.

share|improve this question
    
I'm a little confused. Can you not use something like mysqldump to get a text file version of your DB you want to move? – Doc Jul 13 '11 at 15:18
    
What I did in PhpMyAdmin was to export my DB to a sql file by going to Export , then select SQL and got the sql file. That's is why I need to upload this file. Can I use mysqldump in PhpMyAdmin? how? – chefnelone Jul 13 '11 at 15:23
    
phpmyadmin probably used mysqldump to get you that file. That's fine, you got what you need. The answer given by "Somebody still uses you.." below will do ya.. – Doc Jul 13 '11 at 15:56
up vote 0 down vote accepted
/Applications/MAMP/Library/bin/mysql -h hostDb -u userDb -p nameDb < /Documents/mySql.sql

Don't know if it's going to work since it's a remote database, but to "load" an sql into your database using the command line tools, this is the way to do it.

share|improve this answer
    
I found this single command line to make both: dump the local database and upload to remote database: (only problem is that I can't use SSH) /Applications/MAMP/Library/bin/mysqldump -u root --password=root --host=localhost -C dbname | ssh tastique@tastique.org "mysql -u my_username --password=my_password database_name". I tried it and the local dumping works fine. – chefnelone Jul 13 '11 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .