I have both MariaDB (port 3316) and MySQL (3306) running on the same server with different databases requiring backup.
Both were connected to localhost on the different ports but when I changed the port to 3316 I found that all other localhost entried were also changed.
I found a solution elsehwere on here for two MySQL implementations which were running on different ports, and I used this same approach to fix this.
My MariaDB is set up using localhost /* MARIADB */ for port 3316, and MySQL is using the default localhost on port 3306.