localhost
è di tipo speciale e utilizza socket UNIX anziché TCP/IP. 127.0.0.1
non ottiene quella gestione speciale.
Vedi the documentation:
On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection protocol explicitly, even for localhost, by using the --protocol=TCP option.
Se non funziona quando si utilizza il protocollo TCP/IP quindi il database probabilmente non è in ascolto sulla rete. Questa è generalmente una buona cosa in quanto migliora la sicurezza (non che l'ascolto su 127.0.0.1 esponga problemi, ma l'ascolto su tutte le interfacce offre maggiori opportunità di attacchi).
Se si desidera realmente consentire le connessioni tramite la rete, vedere skip-networking.
Questo dovrebbe essere un "Permesso negato" questione. –
Che piattaforma stai usando, windows o unix? –
@ Jürgen Thelen - Perché dovrebbe? – Quentin