mysqli_real_connect(): (HY000/2002): No such file or directory or connection denied PHPMyAdmin on linux ubuntu apache server, the error occurs because the Mysqld configuration is misconfigured or has the wrong permission set of mysqld.conf file.
Just connect to your ssh server from terminal window, and open the mysqld.conf file with the help of the command nano /etc/mysql/mysql.conf.d/mysqld.cnf
and then add an innodb_force_recovery = 1
line in it to fix mysqli: :real_connect(): (hy000/2002): No such file or directory or connection rejected phpmyadmin with linux ubuntu server.
mysqli_real_connect(): (HY000/2002): No such file or directory
Steps to fix mysqli_real_connect(): (HY000/2002): No such file or directory or connection refused PHPMyAdmin ubuntu linux server:
Step 1 – Login to Your SSH Server
First of all, you need to login into your ssh server with username and password.
Step 2 – Edit MySQLd.conf File
Run the following command into your terminal to edit mysqld.conf file:
nano /etc/mysql/mysql.conf.d/mysqld.cnf OR vi /etc/mysql/mysql.conf.d/mysqld.cnf
After that, add the following line to your MySQLd.cnf file:
innodb_force_recovery = 1
Step 3 – Stop and Start MySQL Server
Finally, restart the mysql server by running the following commands on the terminal to apply the changes and resolve your errors:
sudo systemctl stop mysql.service ---to shut it down sudo systemctl start mysql.service ---to try and start up and see the reason why it is not starting.
Conclusion
That’s it; you have learned how to fix mysqli_real_connect(): (HY000/2002): No such file or directory or connection refused PHPMyAdmin on linux ubuntu apache.