Grepper Logo

sqlstate[hy000]: general error: 1005 can't create table `laravel`.`users` (errno: 150 "foreign key constraint is incorrectly formed") (sql: alter table `users` add constraint `users_role_id_foreign` foreign key (`role_id`) references `role` (`id`))

Technical Problem Cluster First Answered On November 15, 2021 Popularity 9/10 Helpfulness 4/10

Contributions From The Grepper Developer Community

Contents

Code Examples

  • SQLSTATE[HY000]: General error: 1005 Can't create table `laravel`.`users` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `users` add constraint `users_role_id_foreign` foreign key (`role_id`) references `role` (`id`))
  • SQLSTATE[HY000]: General error: 1005 Can't create table ``.`labels` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `labels` add constraint

  • Related Problems

  • sqlstate[hy000]: general error: 1005 can't create table `laravel`.`users` (errno: 150 "foreign key constraint is incorrectly formed") (sql: alter table `users` add constraint `users_role_id_foreign` foreign key (`role_id`) references `role` (`id`))
  • error code: 1005. can't create table `task4`.`indiviual` (errno: 150 "foreign key constraint is incorrectly formed")
  • #1005 - can't create table `lib_sys`.`books` (errno: 150 "foreign key constraint is incorrectly formed")
  • 1215 cannot add foreign key constraint laravel
  • syntax error or access violation: 1072 key column 'priority_id' doesn't exist in table (sql: alter table `todos` add constraint `todos_priority_id_foreign` foreign key (`priority_id`) references `priorities` (`id`))
  • errno 150 foreign key constraint is incorrectly formed laravel 8

  • TPC Matrix View Full Screen

    SQLSTATE[HY000]: General error: 1005 Can't create table `laravel`.`users` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `users` add constraint `users_role_id_foreign` foreign key (`role_id`) references `role` (`id`))

    0
    Popularity 7/10 Helpfulness 4/10 Language whatever
    Link to this answer
    Share Copy Link
    Contributed on Aug 25 2022
    Mohamed Sahfas
    1 Answers  Avg Quality 5/10

    SQLSTATE[HY000]: General error: 1005 Can't create table ``.`labels` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `labels` add constraint

    0
    Popularity 9/10 Helpfulness 1/10 Language php
    Link to this answer
    Share Copy Link
    Contributed on Nov 15 2021
    Excited Elephant
    143 Answers  Avg Quality 7/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.