PMM3.7 - Getting error "tls: failed to verify certificate: x509: certificate is valid for" while adding a MySQL database

Hello dear Percona team,

I am testing PMM 3.7 (Docker container). Setup was all good, but while adding a MySQL database as a target with this command:

sudo pmm-admin add mysql --server-url='https://admin:<pwd>@<host-where-pmm-is-running>:443' --query-source='slowlog' --max-query-length=-1 --username=pmm_user --password='<pwd>' --replication-set='testing' --environment='testing'

I am getting this error:

tls: failed to verify certificate: x509: certificate is valid for localhost, 127.0.0.1, not <host-where-pmm-is-running>

Important to note that the MySQL database being added, is in the same server where the PMM container is running.

This MySQL database is running with “require_secure_transport=ON“ so I cannot use the flag “–server-insecure-tls“ while adding the target.

Any tips on this?

Thanks a lot.

Can you connect via a socket connection?

sudo pmm-admin add mysql \
--server-url='https://admin:<pwd>@<host-where-pmm-is-running>:443' \
--query-source='slowlog' \
--max-query-length=-1 \
--username=pmm_user \
--password='<pwd>' \
--socket=/path/to/mysql.sock \
--replication-set='testing' \
--environment='testing'

Hey jrivera, thanks for the help.

Even using the “–socket“ flag, the same error is thrown:

sudo pmm-admin add mysql --server-url='https://admin:<pwd>@<host-where-pmm-is-running>:443' --query-source='slowlog' --max-query-length=-1 --username=pmm_user --password='<pwd>' --socket=/var/run/mysqld/mysqld.sock --replication-set='testing' --environment='testing'

tls: failed to verify certificate: x509: certificate is valid for localhost, 127.0.0.1, not <host-where-pmm-is-running>