1

By Mistake My mac got shutdown and when i opened it the database was gone from phpmyadmin I have tried php artisan migrate it throws following error

No such file or directory (SQL: select * from information_schema.tables where table_schema = phpdemo and table_name = migrations).

I tried replacing localhost from 127.0.0.1 at DB_HOST in .env file . but no luck I am using xampp , php version 7.2.7

Please help me

Abhishek Sinha
  • 266
  • 3
  • 13
  • https://stackoverflow.com/questions/4219970/warning-mysql-connect-2002-no-such-file-or-directory-trying-to-connect-vi and https://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory might give you some help – aynber Aug 28 '18 at 12:59
  • Or this one, https://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory, this one has like 500 votes and is laravel migration related, check the answer with 500+ votes, not the accepted one – Erubiel Aug 28 '18 at 13:01

2 Answers2

1

firstly you need to check if the mysql service is running, i find this How to check if MySQL server is working or not?

sudo service mysql status

then, check the .env file, and check if the database is created, if not, you can create it and then run

php artisan migrate

If still not working, maybe you'll need to add manually the migrations table, and all the data, that table ony have 3 columns: id, migration, batch (in my case, laravel 5.5), the id is an autoincrements, the migrations has the name of the migration file(for example 2014_10_12_000000_create_users_table) and all the batch columns in my projects has the 1

dlogon
  • 71
  • 1
  • 5
0

I think you can try manually create empty database with name phpdemo and then run php artisan migrate again