I've installed Laravel 5 and Valet (v2.0.12) using Homebrew on my Macbook Pro (running High Sierra (10.13.6)). I've downloaded a clean Laravel project (laravel new blog
).
When I try to migrate (sitting in the project folder, then using php artisan migrate
), nothing happens. Terminal just sits there doing nothing. Command is being executed, but then nothing. No error, no success, nothing. Even adding -v
gives nothing.
I am able to get into the server through command line. I've entered the right credentials inside the .env
file. I can even run other php artisan
commands, but all of the migrate
commands don't do anything.
My migration files are:
2018_09_04_100609_create_users_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
2018_09_04_100659_create_password-resets_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
Update:
Checked DB connection using the following:
try {
DB::connection();
die("success!");
} catch (\Exception $e) {
die("Could not connect to the database. Please check your configuration. error:" . $e );
}
I got "success!".
But then I change DB::connection()
to DB::connection()->getPdo()
it does nothing again. Or isn't that relevant?
I got it fixed. I would add a lot of exclamation marks after that, but I don't feel like it. Why?
Because the problem was that I was using MySQL, whilst I should've been using MariaDB. The guide didn't mention that anywhere, so I just assumed that MySQL was enough. Apparently not. Would've been nice if the error showed something like that...