-3

I have some problems with php artisan migrate. It's only install users and migrations in database but no other files that i have. I installed this project https://github.com/thedevdojo/chatter so you can be sure that code is clear and it's working, it's not problem only on this project but when i type php artisan make:auth it's not installing reset password table but only users and it says like this:

[Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users (id int unsigned not null auto_increment primary key, name varchar(255) not null, email varchar(255) not null,
password varchar(255) not null, remember_token varchar(100) null, created_at timestamp null, updated_at tim estamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)

[PDOException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
Rade
  • 69
  • 3
  • Seems pretty clear to me- you are trying to create a table with the name `users`, but one already exists. – Derek Brown Nov 06 '17 at 02:46
  • I type only php artisan migrate and it should install all databases that is not installed not only users. Just users installs not eaven password reset that is included to php artisan make:auth. But when i type php artisan migrate:status i can see all migrations, i don't know what is the problem – Rade Nov 06 '17 at 02:48
  • you are going to have to be more clear. – Derek Brown Nov 06 '17 at 02:49
  • It **IS** installing a new table called `users`, but you already have one. You need to either delete the existing table, or create a new database. – Derek Brown Nov 06 '17 at 02:50
  • Okay i deleted table users and when i type again "php artisan migrate" it's only installs users but no other tables. – Rade Nov 06 '17 at 02:52
  • @Rade- I am guessing it is throwing a similar error- you need to delete ALL of your tables. – Derek Brown Nov 06 '17 at 02:53
  • @DerekBrown fixed i find it on youtube it was Schema. Thanks :) – Rade Nov 06 '17 at 02:59

1 Answers1

0

try to drop your table in database and do re-migration. if it still didn't work you can check your database.php in folder config. change every utf8mb4 to utf8. This is example before you change your database.php :

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

And after you change:

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

After that you can to drop manual all table in you db, and then do migration again.