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.
For an oneliner, on linux or cygwin, you need to do public key authentication on the host, otherwise ssh will be asking for password.
gunzip -c numbers.sql.gz | ssh user@host mysql --user=user_name --password=your_password db_name
Or do port forwarding and connect to the remote mysql using a "local" connection:
ssh -L some_port:host:local_mysql_port user@host
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.