Error When Importing Database via SSH

September 1, 2022

Well, first, this is how I imported, or tried to import a database via ssh. By default, in phpMyAdmin you can upload/import up to 2MB, hence using SSH.

So, how to import a database via SSH

Upload the database file to the public_html folder, I uploaded a compressed (.sql.gz) version of the database, thinking it would import faster.

1. Connect to your server via SSH using this command

ssh server_username@ip_address

2. Enter the server’s password.

Normally, i’d go to the directory where the database is

3. Import using this command

mysql -u database_username -p database_name < db.sql

database_name: MySQL Database name
database_username: MySQL Username
db.sql: MySQL file

4. After that, you need to enter the database password to start importing.

Problem was, I got this error after I entered the database password:

ERROR: ASCII ‘\0’ appeared in the statement, but this is not allowed unless option –binary-mode is enabled and mysql is run in non-interactive mode. Set –binary-mode to 1 if ASCII ‘\0’ is expected. Query: ‘PK’.

I exported a lot of copies of the database, uploading and importing those, but I’m still getting the same error.

How to solve this issue

Unzip the file in File Manager and then import it via SSH.

Get In Touch

Email: [email protected]


This helps us prevent spam, thank you.