Warning: mysqli_real_connect(): (HY000/2002)

Operating system: Centos 8
OS version:1.974 virtualmin
i use mariadb 10
DB name and user and password is corect !
Hello ! I transferred all the domains from cpanel and they work properly. But when I go to create a new virtual server and build a database and try to connect it to a new wordpress then I have the following error.

Warning: mysqli_real_connect (): (HY000 / 2002): No such file or directory in /home/forum/public_html/wp-includes/wp-db.php on line 1653
No such file or directory

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

  • Are you sure you have the correct username and password?
  • Are you sure you have typed the correct hostname?
  • Are you sure the database server is running?

If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

When a virtual server is created, it automatically creates a database (if the appropriate check box is ticked).

Please explain what you mean by “build a database”.

Are you installing WordPress from Virtualmin’s Install Scripts module, or are you uploading files and installing WordPress manually?

Upload manual the files for install. I mean go to virtualmin-edit databases-creat new

From the error message you have posted, it appears that you have applied the incorrect credentials for the database while you were installing WordPress manually. Each virtual server in Virtualmin has its own set of credentials for the database(s) it owns. you must get the correct credentials from Virtualmin → Edit Databases and then enter them when you install WordPress.

The simplest way forward is, of course, to use Virtualmin’s Install Script module. I think the database credentials are applied automatically when WordPress is installed via this method. Why don’t you try it?

And i have the same problem …

I find that the domains transferred from cpanel work normally but even if I create an additional website they work properly. The problem only becomes when I go to create a NEW domain where I now face the above errors

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