Making Piwik work with skip-name-resolve enabled in mysql?

I just replaced mysql with mariadb but I don’t think it matters in this case:

If I enable skip-name-resolve in my.cnf, Piwik throws a database connection error, saying that it can no longer access the database with user admin@127.0.0.1, so I disabled skip-name-resolve for now.

Piwik is on the same server as the database.

What do I need to do for Piwik to work with skip-name-resolve turned on?

Thanks

You simply need to add a GRANT for your database user. You probably have a GRANT for admin@localhost but not for admin@127.0.0.1. You can check that doing this query as MySQL root:

SELECT User,Host from mysql.user;

You can add the grant with this other query (assuming your database is called “piwik”):

GRANT ALL ON piwik.* TO 'admin'@127.0.0.1;

I think it’s because you are using 127.0.0.1 and the DNS can’t resolve that address. I would try either using the actual IP Address of the machine or creating a hostname and using a local DNS to resolve the hostname.

Thanks. I’d prefer the latter to avoid any external round trips. Assuming I can setup a local DNS to resolve the created hostname, where do I need to make the change so that Piwik uses it? I looked in the Piwik config file but don’t see anything obvious.

You wouldn’t need to. So long as you point your machine at the local DNS Piwik (And everything else) will use the local DNS.

Cool. I’ll give it shot