0

i moved my laravel project from windows to ubuntu, i did everything required ( installing php, composer ...) then when i run php artisan migrate to create my database tables, it says:

In Connection.php line 664:
                                                                             
 SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from informa  
 tion_schema.tables where table_schema = blog and table_name = migrations)     
                                                                               

In Connector.php line 68:
                                                   
 SQLSTATE[HY000] [2002] No such file or directory  

PS: i was using WAMP server for my database in Windows.

my .env DB config:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=blog
DB_PASSWORD=

3 Answers3

0

you are getting that error because php artisan migrate is trying to check the migration table from your database for the migration details, so it doesn't migrate old migrations files again, but since you want to create the tables afresh,

run this
php artisan migrate:fresh this would clear the database and create all table afresh

or run php artisan migrate:install this would create the migration table , then run php artisan migrate to create all other tables

0

Your database seems to be missing the migrations table. You can create it by running

php artisan migrate:install

After that you will be able to run your migrations.

brombeer
  • 8,716
  • 5
  • 21
  • 27
  • its says : Connection refused (SQL: create table `migrations` (` id` int unsigned not null auto_increment primary key, `migration` varchar(25 5) not null, `batch` int not null) default character set utf8mb4 collate 'ut f8mb4_unicode_ci') – Seif Khédija Sep 17 '21 at 11:37
  • You did create your database 'blog' first, right? You can use `phpMyAdmin` (if installed) to create it – brombeer Sep 17 '21 at 11:50
  • You'd also need to create your database user there, giving access to your database. – brombeer Sep 17 '21 at 11:52
-2
  • Use 127.0.0.1 for DB_HOST
  • Run php artisan config:clear
Dharman
  • 30,962
  • 25
  • 85
  • 135