skip to Main Content

I am trying to set up Laravel 11 on Windows 11. I am using WAMPServer for Apache/PHP/MySql.

I have installed the installer globally using Composer. I then run this command to create a Laravel project:

laravel new example-app

However, when I serve it I get this error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘example_app.sessions’ doesn’t exist

If I run the migrations, I get this error:

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

And sure enough, if I log into PHPMyAdmin, the example_app database looks like this:
phpmyadmin

What am I doing wrong here? Thanks in advance

2

Answers


  1. Chosen as BEST ANSWER

    After some further digging I managed to solve this. I tried deleting the user table and re-running migrations, at which point I got an error stating that the length of a varchar column was exceeding the 1000 byte limit.

    What was happening is that the migrations were running when the project was created, but only got as far as creating the user table before silently failing. According to this post, this is the result of a known bug in MySQL when used with MyISAM.

    The fix was to change the storage engine to InnoDB in the WAMPServer settings. I then restarted my system.


  2. I hope you are doing well.
    when you work with Wamp you have to make some changes.
    You can either go to app Service Provider and in Boot write
    Schema::default String Length(191)
    or go to config folder and then go to database PHP file
    in connections->MySQL->’charset’ = change the ‘utf8mb4’ to ‘utf8’
    and under the ‘charset’ you see ‘collation’, in here change the ‘utf8mb4’ to ‘utf8’.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search