dimanche 26 février 2017

Laravel 5.4 database creation failure

I am studying Laravel through their "Basic Task List" tutorial and encountered a problem during the database migration step.

I made the migration file:

php artisan make:migration create_tasks_table --create=tasks

and modified the config/database.php file to the following:

  'driver' => 'mysql',
  'unix_socket'   => '/Applications/MAMP/tmp/mysql/mysql.sock',
  'host' => 'localhost',
  'port' => env('DB_PORT', '3306'),
  'database' => 'laravel',
  'username' => 'root',
  'password' => 'root',
  'charset' => 'utf8mb4',
  'collation' => 'utf8mb4_unicode_ci',
  'prefix' => '',
  'strict' => true,
  'engine' => null,

  1. My practice database name is laravel so I made one in MySQL because of this answer.

  2. unix_socket was added in the configuration as suggested in this answer.

However when I tried

php artisan migrate

I get the following error messages:

[Illuminate\Database\QueryException]                                                                               
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema  
= laravel and table_name = migrations)                                                                            

PDOException]
SQLSTATE[HY000] [2002] No such file or directory  

I also tried executing

php artisan migrate:install

but still cannot proceed

[Illuminate\Database\QueryException]                                                                               
SQLSTATE[HY000] [2002] No such file or directory (SQL: create table `migrations` (`id` int unsigned not null auto  
_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8mb4 co  
llate utf8mb4_unicode_ci)                                                                                          

[PDOException]                                    
SQLSTATE[HY000] [2002] No such file or directory 

Do I have to create the migrations table under the laravel database?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire