I've created user 'demo' and granted privileges for 'demo'@'%'. I can log from any remote server, but when I try to connect from localhost, I get an error:
Access denied for user 'demo_@'%''@'localhost' (using password: YES)
It's quite strange to me, since '%', according to documentation, should match ANY IP address. The obvious solution is to create 2nd set of priviledges for 'demo'@'localhost', but I wonder, is this designed to work that way? Or it has something to do with the way the mysql client tries to connect to DB? (loopback network interface vs. real network interface). Can I connect from mysql client as 'demo'@'%' from the same machine?
--edit--
It has been suggested that my question is the same as Are Users 'User'@'%' and 'User'@'localhost' not the same?, however, it's not the case, because the accepted answer states:
User@% would allow access from all locations.
in my actual case, User@% would allow access from all locations except localhost. Because the answer comes from 2012, and in meantime we've got branch to MariaDB, I provide the exact version information:
D:\xampp\mysql\bin>mysql --version mysql Ver 15.1 Distrib
10.1.16-MariaDB, for Win32 (AMD64)