Please Helpme on this,I have copied a live site to a development environment so I can do some testing. I've followed this tutorial to get everything up and running.

When I go to the site is says that there has been an error. The log says the following: "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I have multiple other magento instances running on the same machine and they all work. The database is on a different machine.

My local.xml is all correct and when I create a simple php test page which contains the following:

      $mysqli=mysqli_connect("[same data as local.xml]");
          printf("Connect failed: %s\n", mysqli_connect_error());
          echo "Connection succesfull!";

The page is returning: Connection succesfull!

I've tried: restarting apache2 and php5-fpm, clearing cache and session folder, removing the other .xml files in /app/etc except local.xml and config.xml.

Can somebody help me fix this problem? Thanks in advance!

see link

  • Check in app/etc/local.xml database credential is correct or not? Commented Jun 13, 2016 at 13:17
  • have you cleaned the var/cache folder? Commented Feb 13, 2019 at 22:15

1 Answer 1

  1. Check for the correctness of your entry made in app/etc/local.xml
  2. Check in the table "core_config_data" for if there is a correct entry for the row of secure and insecure base-URL
  3. Try to replace the .htaccess file present at the root with the .htaccess file which comes with the bare Magento version of your Magento site

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.