laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.65k stars 11.04k forks source link

Laravel 11 Can't create nor connect to MySQL on Install #50536

Closed AllTheUserNamesAreGone closed 8 months ago

AllTheUserNamesAreGone commented 8 months ago

Laravel Version

11.0.2

PHP Version

8.3.3

Database Driver & Version

No response

Description

Trying to install the new Laravel 11 for the first time and can not get it to connect to mysql. Have tried to create the DB manually and it fails and running php artisan migrate, where it asks to create the DB Laravel_11 as it correctly says that it doen't exist and gives:

SQLSTATE[HY000] [1049] Unknown database 'laravel_11' (Connection: mysql, SQL: select table_name as name, (data_length + index_length) as size, table_comment as comment, engine as engine, table_collation as collation from information_schema.tables where table_schema = 'laravel_11' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

I have set the ENV variables which work fine for Laravel 10 and before. I have tried to create the DB manually and still doesn't work.

Screenshot 2024-03-13 at 20 32 33

Steps To Reproduce

Laravel install Laravel_11

Install Jetstream and Livewire Add Email verification and Dark

No to run migrations

Pick mysql as DB

MNhat0308 commented 8 months ago

same issue

subhananam commented 8 months ago

facing the same issue using PHP 8.2.12 and Laravel 11.0.2 , select breeze using react

Edit found solution in

https://stackoverflow.com/questions/78154387/laravel11-mysql-migration-problem-with-collation-general-error-1273-unknown-c

its about the changing of DB_COLLATION

crynobone commented 8 months ago

Can you try with the following configuration:

DB_COLLATION=(null)
driesvints commented 8 months ago

Please fill out your database driver and engine version and don't leave that field blank.

AllTheUserNamesAreGone commented 8 months ago

Can you try with the following configuration:

DB_COLLATION=(null)

This fixed it for me. Thank you.

moerphie commented 8 months ago

Same issue, with a slightly different error log: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'laravel_db' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

AllTheUserNamesAreGone commented 8 months ago

Please fill out your database driver and engine version and don't leave that field blank.

Please fill out your database driver and engine version and don't leave that field blank.

Mysql - Ver 14.14 Distrib 5.7.39, for osx10.12 (x86_64)

driesvints commented 8 months ago

This is now fixed with v11.0.6. Thanks everyone.

cyberfab007 commented 6 months ago

Screenshot 2024-05-09 061534 Still getting this error, MySQL latest, Laravel 11 latest, going back to 10

cyberfab007 commented 6 months ago

DB_COLLATION=utf8mb4_unicode_ci MYSQL_VERSION=latest DB_CONNECTION=mysql DB_HOST=db DB_PORT=6033 DB_DATABASE=app_db DB_USERNAME=root DB_PASSWORD=my_secret_password

driesvints commented 6 months ago

That's not the installer? Try a support channel for your issue: