Laravel

Mysql driver does not work

Hi.

I have a new installation of Laravel and everything worked out fine until I tried to change the driver from sqlite (standard driver from start) to Mysql.

I changed the prefs to:

'mysql' => [
        'driver' => 'mysql',
        'url' => env('DB_URL'),
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'Lara'),
        'username' => env('DB_USERNAME', 'root'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => env('DB_CHARSET', 'utf8mb4'),
        'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
        'prefix' => '',
        'prefix_indexes' => true,
        'strict' => true,
        'engine' => null,
        'options' => extension_loaded('pdo_mysql') ? array_filter([
            PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
        ]) : [],
        ],`

And got this error:

  Illuminate\Database\QueryException 

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'performance_schema.session_status' doesn't exist           (Connection: mysql, SQL: select variable_value as `Value` from performance_schema.session_status where variable_name = 'threads_connected')

But if I change to

  'driver' => 'mariadb',

everything works just fine and I wonder what the Issue is?

jonasgrolin Member
jonasgrolin
0
6
131
alex Member
alex
Moderator

This is very odd, let's get it sorted!

Are you actually running MariaDB or MySQL? And how did you install Laravel, laravel new or something else?

jonasgrolin Member
jonasgrolin

When I run

php artisan db:show 

it says it's MariaDB 10.4.28 and what I can remember, I did the laravel new installation through the command-window.

alex Member
alex
Moderator

It sounds like you're running MariaDB in this case, and don't have MySQL available?

Just trying to figure out whether you're intending to use MySQL or MariaDB :)

jonasgrolin Member
jonasgrolin

I have MySQL installed on my computer. Mysql is the database used in other php-frameworks I have tested and it works fine.... :S

alex Member
alex
Moderator

Just found this!

https://tableplus.com/blog/2019/10/table-performance-schema-session-status-doesnt-exist.html

Hope this helps?

jonasgrolin Member
jonasgrolin

Thanks Alex. I will try it out later this evening.