My Apache and mysql server are installed on the same linux server.
In my mysql configuration file /etc/mysql/my.cnf, I have this line:
bind-address = 192.168.0.12
In my mysql database, I have a user db_user who can only connect from localhost
User Server Password Global privileges "Grant"
db_user localhost Yes USAGE No
What I don’t understand is: how can php connect to mysql tables with db_user and localhost domain if mysql is configured as binding only 192.168.0.12?
I checked the hosts file, localhost send to 127.0.0.1 and not 192.168.0.12.
And the other thing, this command on the server works :
mysql -udb_user -p”password” thedatabase
If you specify
localhostas the host to connect to, MySQL will use a socket, and not a TCP connection.