I can ping successfully from my Windows command line to localhost and to 127.0.0.1, but attempts to connect with mysql.exe fail...
I found similar errors but their suggested solutions don't work/apply...
Host is not allowed to connect to MySQL
Host not Allowed Connectivity to MySQL Server
I'm using a Windows 7 WAMP environment (an old Zend installation) meaning its all local (connections made from localhost/127.0.0.1). All worked fine last Friday when I did an import of a database, today, I get the cannot connect error. I did not overwrite mysql database (or at least, i am pretty sure I did not), so the error has taken me a little by surprise.
C:\Backups\Daily\201607>ping /n 1 localhost
Pinging Silver [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Ping statistics for ::1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Backups\Daily\201607>ping /n 1 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Backups\Daily\201607>mysql --user=root
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
C:\Backups\Daily\201607>mysql --user=root --host=localhost
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
My partial extract from my.ini file:
[client]
port=3306
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files (x86)/Zend/MySQL55/"
#Path to the database root
datadir="C:/Program Files (x86)/Zend/MySQL55/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server = utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
I'm curious on what went wrong - I suspect I'm responsible for it but lack a history file to examine the error of my ways.
Can anyone advise how I can fix and reconnect?
ONLY_FULL_GROUP_BY
to my sql-mode in my.ini if I were you.