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.
Just follow:
https://devdocs.magento.com/cloud/setup/first-time-setup-import-import.html
And,
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
sudo mysql -u <DB_username> -p <databse_name> < /databse_file_path/databse_file.sql