I can't connect to MySQL from the WEB page

I installed AlmaLinux 9. all good.
I installed LAMP as a WEB server stack with MySQL using this guide

Also, all good, until…
I whant to connect from a web page to a MySQL database as user with all rights on database.
That didn’t work anymore!
I can connect by localhost, but NOT by the static IP set for the server.
I opened the port and the service on TCP in Firewal-cmd, I put bind-address for the server that IP, I even set all the rights for ‘user’ @ ‘%’ although I would have wanted only for a certain IP, but still no go.
I am stuck!
Has anyone had this problem before?
Or can someone help with a new idea?
PS. I run AlmaLinux in a VirtualBox vm under a Windows server. (if it matters)

mysql only listens on localhost by default. You have to enable all interfaces to allow remote connections.

I don’t remember the details of my MySQL days, but you need to make the server respond to localhost or or the LAN IP of your box. I’m assuming it’s the same machine. Read up on those files.

Hi. Thanks for the reference. Very explicit.
Unfortunately, I did all these steps and I get the same result.
Look result of the connection:

Connect to DB as dbuser from localhost (<- good from local)
Connect Successfully. Host info: Localhost via UNIX socket

Connect to DB as dbuser from xxx.xxx.xxx.16 (<- this is the static MySQL server IP)
ERROR: Could not connect. Permission denied

The last is when i try to connect with external server IP, which I need when I connect remotely.
So, still unresolved.

Make sure the user is defined. In your example, dbuser@xxx.xxx.xxx.16 or dbuser@% needs to be defined.

Login to localhost and run the "select user,host from mysql.user; " command.


look ok to me.

Last thing I would check is the firewall settings and the log in /var/log/. Make sure port 3306 is allowed if your firewall is enabled.

I’m running mariadb, so my logs are in /var/log/mariadb. mysql may have logs in /var/log/mysql.


3306 allowed
In mysql log I find this after a coonect try:
2022-07-02T11:44:09.780416Z 39 [Warning] [MY-010055] [Server] IP address ‘’ could not be resolved: Name or service not known
No ideea whay!!! the IP is allowed in firewall as source “sources:”, user exist on host.
Stuck and stuck.
Everything seems ok but it doesn’t connect.

“Resolved” sounds like mysql attempts to find a (DNS) name for the IP address.

mysql is doing a reverse lookup for Add an entry to the /etc/hosts file. RemoteHostname

It’s something very strange. I followed all the steps, the checks give correct results, except for connecting to databases on the LAN.
I think I will try another version of linux.
Anyway, thanks for your help.
Good luck! (To me, It seems necessary when I do some administrator work :slight_smile: )