I want to import SQL file in cloud project magento2.

by ssh i login and import db then i am getting mysql server gone away after little time later.

3 Answers 3


Just follow:



For PHP: And increase default_socket_timeout in your php.ini

For MariaDB ( so probably you have to change this one only)

SELECT @@wait_timeout;

SET GLOBAL wait_timeout=600;

SELECT @@max_allowed_packet;

SET GLOBAL max_allowed_packet=107374182

Then restart the server and try importing again. Maybe check first this values to get back after import.


You can use SSH tunneling to connect to a service from your local development environment as if the service were local. Using magento-cloud cli

Step 1: Use a terminal application to log in and issue commands.

magento-cloud login

Step 2: Set up the SSH tunnel

magento-cloud tunnel:open -p <PROJECT_ID> -e <ENVIRONMENT_ID>

The response will include database connection like this

SSH tunnel opened to database at: mysql://username:[email protected]:PORT/database_name?compression=1

Use that credential to connect to the env's database on your local and do the things you want

Read more here

  1. Upload the .sql database file on the cloud
  2. Crate empty database on mysql
  3. Open ssh
  4. Run command

sudo mysql -u <DB_username> -p <databse_name> < /databse_file_path/databse_file.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.