This article provides a solution for Adobe Commerce (all deployment methods) issues, where the outage of space allocated for MySQL causes stuck deployment or database connection errors.
bash Re-deploying environment abcdefghijklm-master-7rqtwti E: Environment redeployment failed
bash SQLSTATE[HY000] [2006] MySQL server has gone away
and the following error appears when you connect to a MySQL server: bash ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"
The most probable cause of the issues is the MySQL database allocated space being too low. To make sure this is the case, check the space available for MySQL as described further.
For all Adobe Commerce on cloud infrastructure Starter plan architecture environments, and Integration environment of the Adobe Commerce on cloud infrastructure Pro plan architecture, SSH to the environment and run the command:
magento-cloud db:size
For the Staging or Production environment of the Pro architecture, SSH to the environment, and run the df -h
| grep mysql
command. The result will look similar to the following:
sxpe7gigd5ok2@i-00baa9e24f31dba41:~$ df -h | grep mysql
/dev/xvdj 40G 7.4G 32G 19% /data/mysql
For all Starter architecture and Pro architecture Integration environments, this is done in the .magento/services.yaml
file, by increasing the mysql: disk:
parameter. For example:
mysql:
type: mysql:10.0
disk: 2048
See the Set up MySQL service article for reference.
To make these changes for the Staging or Production environment of the Pro architecture, you must create a Support ticket. But typically, you will not have to deal with this on Staging/Production of the Pro architecture as Adobe Commerce monitors these parameters for you and alerts you and/or takes actions according to the contract.
Once you change the .magento/services.yaml
file, you need to commit and push your changes for them to be applied. The push will trigger the deployment process.