Você tem um usuário anônimo para o host local e esse usuário anônimo não tem nenhuma senha.
It is necessary to have both (
%
andlocalhost
) accounts for yourmyuser
to be able to connect from anywhere asmyuser
. Without the localhost account, theanonymous user
account forlocalhost
that is created bymysql_install_db
would take precedence whenmyuser
connects from thelocalhost
. As a result,myuser
would be treated as ananonymous user
. The reason for this is that the anonymous-user account has a more specific Host column value than themyuser'@'%'
account and thus comes earlier in the user table sort order.
Sobre a ordem de classificação:
The server uses sorting rules that order rows with the most-specific Host values first. Literal host names and IP addresses are the most specific. (The specificity of a literal IP address is not affected by whether it has a netmask, so for example
192.168.1.13
and192.168.1.0/255.255.255.0
are considered equally specific.) The pattern'%'
means"any host"
and is least specific. The empty string''
also means"any host"
but sorts after'%'
. Rows with the same Host value are ordered with the most-specific User values first (a blank User value means"any user"
and is least specific).
Portanto, mysql
está considerando seu myuser
como anonymous user
e, como o anonymous user
para localhost
não tem senha, é possível efetuar login sem senha.
Para resolver seu problema, basta criar um usuário localhost
para seu myuser
com senha