Which MySQL server am I using?
Archive - Originally posted on "The Horse's Mouth" - 2005-11-07 18:09:50 - Graham EllisOn occasions during MySQL courses, our trainees find that data they thought they had uploaded isn't available to them, or that they're denied login when they feel they've entered the correct user name and password. There are two reasons this can happen:
a) MySQL logins depend on user name, password, and the name / IP address of the computer from which the connection is being made. This "per host computer" feature is a great help in security terms, but it can be set up very confusingly.
b) If you run a MySQL client ... where does it decide which host to contact?
i) If you specify a -h on the command line of the client, that host takes precedence
ii) If you specify a host in your personal MySQL config file (.my.cnf on Unix / Linux), then that host is used (unless one is specified on the command line)
iii) If a host is specified in the client-system wide MySQL config file (/etc/my.cnf) then that host is used unless it's overidden by the setting in item (i) or item (ii) above
Iv) If none of the above is specified, MySQL falls back to connecting to localhost.