I faced the same problem today, it seems like the docs are a little bit outdated, i was able to make it work with this docker compose file:
mysqld-exporter:
image: quay.io/prometheus/mysqld-exporter
container_name: mysqld-exporter
restart: unless-stopped
command:
- "--mysqld.username=user:password"
- "--mysqld.address=host:port"
networks:
- mynet