MariaDB not connecting from PHP

SYSTEM INFORMATION
OS type and version Ubuntu 24.04
Webmin version 2.510
Virtualmin version 7.40.1
Webserver version Apache version 2.4.58
Related packages SUGGESTED

Hi,

Just installed virtualmin GPL, created a virtualserver, a db and trying to connect.

I get ERROR 1044 (42000): Access denied for user 'user'@'localhost' to database 'database' from php or from cli

Is there anything I can try to debug/resolve? already tried to change the password, change/save allowed hosts…

are you connecting using database credentials ? (not the same with virtualmin user)
Virtual Server → Edit Databases → usernames / passwords

Bit more info, how did you create the database? In the GUI?

Hi,

I can connect with no db selected

mysql -u user -p

I cannot connect with db selected:

mysql database -u user -p

So I do not think it’s a password problem?

It is the default db created from the virtual server creation, I just executed a dump.sql to migrate a wordpress site.

so this user has no permissions on this db. is this db associated with the specific virtual server?

Ok, so I am very shameful: the database was created with a littlebit changed name:

server name: domain-one.com
user name: domain-one (domain and db)
db: domain_one (see the underscore)

So using the right db name (I was firstly confused by the underscore), it works.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.