mysqli_real_connect(): (HY000/2002): No such file or directory

mysqli_real_connect(): (HY000/2002): No such file or directory

mysqli_real_connect(): (HY000/2002): No such file or directory; In this tutorial, you will learn how to fix/resolve mysqli_real_connect(): (HY000/2002): No such file or directory or connection refused in PHPMyAdmin in linux ubuntu apache.

mysqli_real_connect(): (HY000/2002): No such file or directory

Let’s use the following steps to fix or resolve mysqli_real_connect(): (HY000/2002): No such file or directory or connection refused in PHPMyAdmin:

  • Step 1 – Login to Your SSH Server
  • Step 2 – Edit MySQLd.conf File
  • Step 3 – Stop and Start MySQL 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

Then execute the following command into your terminal:

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 MySQL.cnf file:

innodb_force_recovery = 1

Step 3 – Stop and Start MySQL Server

Finally, execute the following command into your terminal to stop and start your mysql server:

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; In this tutorial, you have learned how to fix/resolve mysqli_real_connect(): (HY000/2002): No such file or directory or connection refused in PHPMyAdmin in linux ubuntu apache.

Recommended Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *