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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The file is a gzipped (compressed) SQL file, almost certainly a plain text file with .sql as its extension. The first thing you need to do is copy the file to your database server via scp.. I think PuTTY’s is pscp.exe
Then SSH into your server and uncompress the file with
gunzipFinally, import it into your MySQL database using the
<input redirection operator:If the numbers.sql file doesn’t create a database but expects one to be present already, you will need to include the database in the command as well:
If you have the ability to connect directly to your MySQL server from outside, then you could use a local MySQL client instead of having to copy and SSH. In that case, you would just need a utility that can decompress .gz files on Windows. I believe 7zip does so, or you can obtain the gzip/gunzip binaries for Windows.