Help with migrations in Laravel 5.5

1

When I perform the classic migration to start my BD in PHPMyadmin I get these errors, but to all this it generates the 2 tables by default but other tables no longer accept me ... Someone can help me please is urgent

  

c: \ xampp \ htdocs \ test1> php artisan migrate

     

In Connection.php line 664:

     

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 status null) default character set utf8mb4 collate   utf8mb4_unicode_ci)

     

In Connection.php line 458:

     

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

    
asked by Williams Camones Moreno 27.04.2018 в 05:42
source

2 answers

3

The error is telling you that the users table already exists, if you have no problem deleting it, then execute the following command

How are you using version 5.5 you already have the following command available to carry out the migration?

php artisan migrate:fresh

To delete the tables in your database with this command and make them all from scratch

For the final problem that you mention in the comments I mention it, it is solved like this:

  • open the file called AppServiceProvider.php (this file is inside the folder app/providers ) and within the method boot() add this line
  • Schema::defaultStringLength(191);

  • And at the top right after the call to the namespace App , also add this line
  • use Illuminate\Support\Facades\Schema;

  • Repeat the command:
  • php artisan migrate:fresh

      

    (this command is available since version 5.5 of Laravel   Framework)

      

    I also give you as to the alternative for this error that arises,   update to the version of mysql 5.7, considering that only if it is   feasible and always with FULLY FUNCTIONAL backups of your bases   OF DATA

        
    answered by 27.04.2018 в 05:55
    0

    At last I solved it, the detail is that I necessarily believe you should use homestead for laravel or as simple as changing server or service package for php and mysql, such as the use of LARAGON, useful tool that contains a server built-in virtual, php, mysql, also has a good terminal (cmder), and a BD server (HeidiSQL) I left my problem now to continue .. Thanks for the help to those who responded ... WJCM

        
    answered by 30.04.2018 в 05:23