Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laravel 5.4 install mysql error #43

Open
zanjs opened this issue Mar 6, 2017 · 5 comments
Open

laravel 5.4 install mysql error #43

zanjs opened this issue Mar 6, 2017 · 5 comments

Comments

@zanjs
Copy link
Owner

zanjs commented Mar 6, 2017

[5.4] SQL error when migrating tables

 php artisan migrate
Migration table created successfully.


  [Illuminate\Database\QueryException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `
  users_email_unique`(`email`))



  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes



  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

more

https://github.com/laravel/docs/blob/5.4/migrations.md

In your appserviceprovider boot method, try adding

use Illuminate\Support\Facades\Schema;

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

Best sure to import Illuminate\Support\Facades\Schema at the top of the service provider.
There's a note about this in the 5.4 documentation. It's possible this is what is causing your problems.

@zanjs zanjs changed the title panlisale_H5.aspx laravel 5.4 install mysql error Mar 10, 2017
@maryxyan
Copy link

Try dropping the tables from your DB and run php artisan migrate again.

@zanjs
Copy link
Owner Author

zanjs commented Mar 17, 2017

@maryxyan Thinks 😏

@karllo
Copy link

karllo commented May 24, 2017

have you solved your problem?
I still have this error

@karllo
Copy link

karllo commented May 24, 2017

like this

λ php artisan voyager:install --with-dummy
Publishing the Voyager assets, database, and config files
Copied Directory [\vendor\tcg\voyager\publishable\assets] To [\public\vendor\tcg\voyager\assets]
Copied Directory [\vendor\tcg\voyager\publishable\database\migrations] To [\database\migrations]
Copied Directory [\vendor\tcg\voyager\publishable\database\seeds] To [\database\seeds]
Copied Directory [\vendor\tcg\voyager\publishable\demo_content] To [\storage\app\public]
Publishing complete.
Publishing complete.
Migrating the database tables into your application
Migration table created successfully.

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table tran slations add unique translations_table_name_column_name_foreign_key_locale_unique(table_name, column_name, foreign_key, locale ))

[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

@maryxyan
Copy link

maryxyan commented May 25, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants