Migrating PHP artisan does not create a new table

I am new to Laravel, and I follow as Laravel Documentationswell as a few tutorial videos. However, I am running this code php artisan migratelocally CMD promptand not creating Database Tablein phpmyadmin. There are a few more similar topics related to this in stackoverflow, but no one solved my problem. Do not specify this duplicate.

Well, everything goes like that. I run this code

php artisan make:migration create_student_table --create=student

and a new file is created in the migration folder as 2016_04_08_061507_create_student_table.php

Then in this file I run this code

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

    class CreateStudentTable extends Migration
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::create('student', function (Blueprint $table) {
                $table->increments('id');
                $table->timestamps();
                $table->string('name', 20); 
                $table->string('email', 255);
            });
        }

        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::drop('student');
        }
    }

Then in cmdI launched php artisan migrate, but did not create a table student. Instead, it shows this message

[PDOException] SQLSTATE [42S01]: base table or view already exists: 1050 user table already exists

users , , . student . - ? .

+10
9

, Laravel users. , users, php artisan migrate

+11

\ , . , .

, php artisan migrate , . composer dump-autoload, .

php artisan migrate. php artisan migrate:rollback

, , php artisan migrate:reset.

php artisan migrate --force, .

, , , php artisan migrate.

+4

Laravel (mac os Sierra 10.12.16) MAMP , .

, , , ,

IN AppServiceProvider.php  add the following code:

use Illuminate\Support\Facades\Schema;

public function boot()
{
    //
    Schema::defaultStringLength(191);
}

then in database.php:

'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

THEN FINALLY IN .env:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=
DB_DATABASE=hackable
DB_USERNAME=root
DB_PASSWORD=root

, -, , , , :)

+2

, larvel .

+1

? , create :

if(!Schema::hasTable('users')) ...
+1

, MAMP, - . - , MAMP mysql 8889, , .

0

.

php artisan migrate . :

"In Connection.php line 647: SQLSTATE[42000]: syntax error or acces violation:1071 specified key was too long; max key length is 767 bytes"

/ , , . php/laravel? , , php 5.6 7, laravel - 5.4.

,

0

?

php artisan migrate:fresh fresh.

0

:

php artisan migrate.
-2

All Articles