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.
If you have scp then:
To move your file from local to remote:
$scp /home/user/file.gz user@ipaddress:path/to/file.gz
To move your file from remote to local:
$scp user@ipaddress:path/to/file.gz /home/user/file.gz
To export your mysql file without login in to remote system:
$mysqldump -h ipaddressofremotehost -Pportnumber -u usernameofmysql -p databasename | gzip -9 > databasename.sql.gz
To import your mysql file withoug login in to remote system:
$gunzip < databasename.sql.gz | mysql -h ipaddressofremotehost -Pportnumber -u usernameofmysql -p
Note: Make sure you have network access to the ipaddress of remote host
To check network access:
$ping ipaddressofremotehost