rambo123
rambo123

Reputation: 85

Import .sql file using ssh

I read many tutorials online on how to import sql scripts using ssh, and that is mysql –u [username] –p [database] < [file_name].sql but only works for single database. I created an sql file of my localhost (all databases), I did this using PhpMyAdmin and tried to use the code of importing but nothing happens.

Is there a separate way on how to do this?

Upvotes: 1

Views: 3959

Answers (2)

mysql -h localhost -u root -p -e "source d:\test.sql"

Upvotes: 1

jeberle
jeberle

Reputation: 758

As long as you don't specify the --one-database arg, there's nothing preventing you from adding a USE <some-other-db>; statement as necessary within your .sql file.

Upvotes: 0

Related Questions