I want to insert a sql.gz
file into my database with SSH. What should I do?
For example I have a database from telephone numbers that name is numbers.sql.gz
, what is this type of file and how can I import this file into my database?
I want to insert a sql.gz
file into my database with SSH. What should I do?
For example I have a database from telephone numbers that name is numbers.sql.gz
, what is this type of file and how can I import this file into my database?
For an oneliner, on linux or cygwin, you need to do public key authentication on the host, otherwise ssh will be asking for password.
Or do port forwarding and connect to the remote mysql using a "local" connection:
then do the mysql connection on your local machine to localhost:some_port.
The port forwarding will work from putty too, with the similar -L option or you can configure it from the settings panel, somewhere down on the tree.
If the mysql dump was a .gz file, you need to gunzip to uncompress the file by typing $ gunzip mysqldump.sql.gz
This will uncompress the .gz file and will just store mysqldump.sql in the same location.
Type the following command to import sql data file:
$ mysql -u username -p -h localhost test-database < mysqldump.sql password: _