MySQL to PGLoader migration error on Managed database

June 18, 2019 1.4k views
PostgreSQL MySQL Databases

I’m trying to migrate to a managed database, as described in the last section of this tutorial. I apologize, but I’m a bit new to database migration.

When I enter this command:

pgloader mysql://DBUSER:DBPASS@localhost/DBNAME postgresql://doadmin:PASSWORD@stuff.db.ondigitalocean.com:25060/DBNAME?sslmode=require

I get this error:

Failed to connect to pgsql at "stuff.db.ondigitalocean.com" (port 25060) as user "doadmin": SSL verify error: 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN

I’m a little lost here.

2 Answers

Hey there @webmin,

Have you tried running the following instead:

pgloader mysql://DBUSER:DBPASS@localhost/DBNAME postgresql://doadmin:PASSWORD@stuff.db.ondigitalocean.com:25060/DBNAME

Note the removed ?sslmode=require from the Postgres connection.
The error implies it is trying to force an SSL connection but failing because the SSL certificate that is present is only a self-signed one and not a properly validated one.

Let me know how it goes!
- Matt.

@webmin Try to add --no-ssl-cert-verification right after pgloader as shown below.

pgloader --no-ssl-cert-verification mysql://DBUSER:DBPASS@localhost/DBNAME postgresql://doadmin:PASSWORD@"stuff.db.ondigitalocean.com:25060/DBNAME?sslmode=require"

Btw I had to wrap the server address of the PostgreSQL server into quotes on macOS. Otherwise I was not able to add the needed sslmode option at the end without triggering an error.

Have another answer? Share your knowledge.