<p>I'm trying to sync the database for my local <a href="https://craftcms.com/docs/nitro/2.x/" rel="nofollow noreferrer">Craft Nitro</a> to the staging environment using <a href="https://unionco.github.io/craft-plugin-docs/craft-sync-db/#configuration" rel="nofollow noreferrer">SyncDB</a>.</p>
<p>Here is the error,</p>
<pre><code>[2021-06-04T15:49:51.623536+08:00] sync.NOTICE: Starting database sync [] []
[2021-06-04T15:49:51.624538+08:00] sync.INFO: Beginning remote dump [] []
[2021-06-04T15:49:51.625672+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.625781+08:00] sync.ERROR: Failed on command: ssh username@mysite.com -p 22 &quot;/usr/bin/php /var/www/html/mysite/craft sync-db/sync/dump normal 1&quot; [] []
[2021-06-04T15:49:51.625841+08:00] sync.ERROR: sh: ssh: not found [] []
[2021-06-04T15:49:51.625921+08:00] sync.INFO: Beginning remote download [] []
[2021-06-04T15:49:51.626935+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.627036+08:00] sync.ERROR: Failed on command: scp -P 22 username@mysite.com:/var/www/html/mysite/storage/backups/db_dump.sql.tar.gz /app/storage/backups/databases/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.627088+08:00] sync.ERROR: sh: scp: not found [] []
[2021-06-04T15:49:51.627156+08:00] sync.INFO: Beginning delete remote file [] []
[2021-06-04T15:49:51.628334+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.628417+08:00] sync.ERROR: Failed on command: ssh username@mysite.com -p 22 rm /var/www/html/mysite/storage/backups/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.628463+08:00] sync.ERROR: sh: ssh: not found [] []
[2021-06-04T15:49:51.628510+08:00] sync.INFO: Beginning extract archive [] []
[2021-06-04T15:49:51.630506+08:00] sync.ERROR: return non-zero: 2 [] []
[2021-06-04T15:49:51.630609+08:00] sync.ERROR: Failed on command: cd /app/storage/backups/databases &amp;&amp; tar -xzvf db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.630662+08:00] sync.ERROR: tar (child): db_dump.sql.tar.gz: Cannot open: No such file or directory [] []
[2021-06-04T15:49:51.630708+08:00] sync.ERROR: tar (child): Error is not recoverable: exiting now [] []
[2021-06-04T15:49:51.630801+08:00] sync.ERROR: tar: Child returned status 2 [] []
[2021-06-04T15:49:51.630847+08:00] sync.ERROR: tar: Error is not recoverable: exiting now [] []
[2021-06-04T15:49:51.630910+08:00] sync.INFO: Beginning import sql [] []
[2021-06-04T15:49:51.633151+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.633235+08:00] sync.ERROR: Failed on command: mysql -u nitro -h mysql-5.6-3306.database.nitro -P 3306 --password=&quot;*****&quot; mysitesite  &lt; /app/storage/backups/databases/db_dump.sql [] []
[2021-06-04T15:49:51.633297+08:00] sync.INFO: Beginning remove local sql file [] []
[2021-06-04T15:49:51.643340+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.643447+08:00] sync.ERROR: Failed on command: rm /app/storage/backups/databases/db_dump.sql [] []
[2021-06-04T15:49:51.643493+08:00] sync.ERROR: rm: can't remove '/app/storage/backups/databases/db_dump.sql': No such file or directory [] []
[2021-06-04T15:49:51.643539+08:00] sync.INFO: Beginning remove local archive [] []
[2021-06-04T15:49:51.645352+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.645438+08:00] sync.ERROR: Failed on command: rm /app/storage/backups/databases/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.645479+08:00] sync.ERROR: rm: can't remove '/app/storage/backups/databases/db_dump.sql.tar.gz': No such file or directory [] []
[2021-06-04T15:49:51.645515+08:00] sync.NOTICE: Database sync complete [] []
[2021-06-04T15:49:51.645552+08:00] sync.INFO: Craft SyncDB Complete [] []
</code></pre>
<p>I manage to access the command</p>
<blockquote>
<p>ssh username@mysite.com -p 22</p>
</blockquote>
<p>from my terminal, I unsure what is the issue and how can I resolve it?</p>
<p>Here is my local application info,</p>
<pre><code>MySQL 5.6.51
PHP 7.4.16
OS version Linux 5.4.72-microsoft-standard-WSL2
Craft 3.6.13
Sync DB 0.8.0.1
</code></pre>
<p>Here is my staging application info,</p>
<pre><code>MySQL 5.5.5
PHP 7.4.18
OS version Linux 5.4.0-1048-aws
Craft 3.6.13
Sync DB 0.8.0.1
</code></pre>

CC BY-SA 4.0
2021-06-02T18:54:49.327Z
I haven't used SyncDb before but from the screenshot, you have the Nitro MySQL server set up as Production, and trying to connect via SSH on port 3306. Port 20 is the default SSH port. From the SyncDb README: "Only remote servers (production, staging, etc) should be configured in the configuration file. The local environment is determined by your .env file."
CraftQuest
CC BY-SA 4.0
2021-06-03T12:26:15.820Z
Correction on my typo: port 22 is the default ssh port.
CraftQuest
CC BY-SA 4.0
2021-06-04T05:54:56.497Z
Your dump client path shows its using pg_dump but you are using a mysql db. Try changing the dump path to the path where mysqldump is located.
Tim Strawbridge
CC BY-SA 4.0
2021-06-04T08:24:57.523Z
I have updated the path for mysqldump, but still getting the error.
Lee
CC BY-SA 4.0
2021-06-05T13:37:24.970Z
What OS is your local system?
Tim Strawbridge
CC BY-SA 4.0
2021-06-07T03:37:11.423Z
I have updated my OS version to my question. @TimStrawbridge
Lee
<database><mysql><server><craft-features><nitro>
SyncDB with Nitro Fail to sync database from local to staging
# SyncDB with Nitro Fail to sync database from local to staging

(Asked by: username_0 on 2021-06-02)

I'm trying to sync the database for my local Craft Nitro to the staging environment using SyncDB.
Here is the error,
[2021-06-04T15:49:51.623536+08:00] sync.NOTICE: Starting database sync [] []
[2021-06-04T15:49:51.624538+08:00] sync.INFO: Beginning remote dump [] []
[2021-06-04T15:49:51.625672+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.625781+08:00] sync.ERROR: Failed on command: ssh username@mysite.com -p 22 "/usr/bin/php /var/www/html/mysite/craft sync-db/sync/dump normal 1" [] []
[2021-06-04T15:49:51.625841+08:00] sync.ERROR: sh: ssh: not found [] []
[2021-06-04T15:49:51.625921+08:00] sync.INFO: Beginning remote download [] []
[2021-06-04T15:49:51.626935+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.627036+08:00] sync.ERROR: Failed on command: scp -P 22 username@mysite.com:/var/www/html/mysite/storage/backups/db_dump.sql.tar.gz /app/storage/backups/databases/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.627088+08:00] sync.ERROR: sh: scp: not found [] []
[2021-06-04T15:49:51.627156+08:00] sync.INFO: Beginning delete remote file [] []
[2021-06-04T15:49:51.628334+08:00] sync.ERROR: return non-zero: 127 [] []
[2021-06-04T15:49:51.628417+08:00] sync.ERROR: Failed on command: ssh username@mysite.com -p 22 rm /var/www/html/mysite/storage/backups/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.628463+08:00] sync.ERROR: sh: ssh: not found [] []
[2021-06-04T15:49:51.628510+08:00] sync.INFO: Beginning extract archive [] []
[2021-06-04T15:49:51.630506+08:00] sync.ERROR: return non-zero: 2 [] []
[2021-06-04T15:49:51.630609+08:00] sync.ERROR: Failed on command: cd /app/storage/backups/databases && tar -xzvf db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.630662+08:00] sync.ERROR: tar (child): db_dump.sql.tar.gz: Cannot open: No such file or directory [] []
[2021-06-04T15:49:51.630708+08:00] sync.ERROR: tar (child): Error is not recoverable: exiting now [] []
[2021-06-04T15:49:51.630801+08:00] sync.ERROR: tar: Child returned status 2 [] []
[2021-06-04T15:49:51.630847+08:00] sync.ERROR: tar: Error is not recoverable: exiting now [] []
[2021-06-04T15:49:51.630910+08:00] sync.INFO: Beginning import sql [] []
[2021-06-04T15:49:51.633151+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.633235+08:00] sync.ERROR: Failed on command: mysql -u nitro -h mysql-5.6-3306.database.nitro -P 3306 --password="*****" mysitesite  < /app/storage/backups/databases/db_dump.sql [] []
[2021-06-04T15:49:51.633297+08:00] sync.INFO: Beginning remove local sql file [] []
[2021-06-04T15:49:51.643340+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.643447+08:00] sync.ERROR: Failed on command: rm /app/storage/backups/databases/db_dump.sql [] []
[2021-06-04T15:49:51.643493+08:00] sync.ERROR: rm: can't remove '/app/storage/backups/databases/db_dump.sql': No such file or directory [] []
[2021-06-04T15:49:51.643539+08:00] sync.INFO: Beginning remove local archive [] []
[2021-06-04T15:49:51.645352+08:00] sync.ERROR: return non-zero: 1 [] []
[2021-06-04T15:49:51.645438+08:00] sync.ERROR: Failed on command: rm /app/storage/backups/databases/db_dump.sql.tar.gz [] []
[2021-06-04T15:49:51.645479+08:00] sync.ERROR: rm: can't remove '/app/storage/backups/databases/db_dump.sql.tar.gz': No such file or directory [] []
[2021-06-04T15:49:51.645515+08:00] sync.NOTICE: Database sync complete [] []
[2021-06-04T15:49:51.645552+08:00] sync.INFO: Craft SyncDB Complete [] []

I manage to access the command

ssh username@mysite.com -p 22

from my terminal, I unsure what is the issue and how can I resolve it?
Here is my local application info,
MySQL 5.6.51
PHP 7.4.16
OS version Linux 5.4.72-microsoft-standard-WSL2
Craft 3.6.13
Sync DB 0.8.0.1

Here is my staging application info,
MySQL 5.5.5
PHP 7.4.18
OS version Linux 5.4.0-1048-aws
Craft 3.6.13
Sync DB 0.8.0.1

**Tags:** database, mysql, server, craft-features, nitro
> **Comments:**
> **username_1**: I haven't used SyncDb before but from the screenshot, you have the Nitro MySQL server set up as Production, and trying to connect via SSH on port 3306. Port 20 is the default SSH port. From the SyncDb README: "Only remote servers (production, staging, etc) should be configured in the configuration file. The local environment is determined by your .env file."  
> **username_1**: Correction on my typo: port 22 is the default ssh port.  
> **username_2**: Your dump client path shows its using pg_dump but you are using a mysql db. Try changing the dump path to the path where mysqldump is located.  
> **username_0**: I have updated the path for mysqldump, but still getting the error.  
> **username_2**: What OS is your local system?  
> **username_0**: I have updated my OS version to my question. @TimStrawbridge  

---

## 0 answers

