I'm using Magento 2 and would like to know where the log files are for mysql. Are they inside my main magento folder or are they elsewhere. I know that the main log files for magento are in var/log but I cannot seem to find the mysql errors. ]

Reason I'm looking is to solve:

>[2018-09-17 20:59:51] main.ERROR: MySQL connection failed: SQLSTATE[HY000] [2002] No such file or directory [] []

  • That means your mysql is not running . please restart wamp or xamp or apache2 etc Sep 18, 2018 at 11:56
  • Re install the server. Then only it will work Sep 18, 2018 at 12:40
  • I've had this issue with 2 fresh copies of Magento 2 now. After about 2 weeks of smooth running, the servers seem to crash daily. If you are knowledgeable on this matter, i encourage you to view my other question on this topic: magento.stackexchange.com/questions/242667/…
    – Greg
    Sep 18, 2018 at 13:17

1 Answer 1


Hey can you check your mysql server is running or not because your magento 2 is unable to create connection to your mysql and also check which database you mention in app/etc env.php file.

  • I've restarted my server and everything seems fine now. Recently, my server has been crashing daily and i'm not sure why. This is my log
    – Greg
    Sep 18, 2018 at 11:54
  • Please mark as solution if it works for you .also share your log so that we can dig up the issue. Sep 18, 2018 at 11:58
  • My question was about the location of mysql log files. Do you know where they are located? I posted a question earlier that includes the log: magento.stackexchange.com/questions/242667/…
    – Greg
    Sep 18, 2018 at 12:01
  • 2
    No In my knowledge if any mysql error comes then it always go to exception.log . it won't generate separate log file for Mysql errors. You can find exception.log here:- var/log/exception.log Sep 18, 2018 at 12:04

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.