1

I tried running command: php artisan migrate, but it gave me below error.

ERROR:

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667▕         // If an exception occurs when attempting to run a query, we'll format the error
    668▕         // message to include the bindings with SQL, which will make this exception a
    669▕         // lot more helpful to the developer instead of just the database's errors.
    670▕         catch (Exception $e) {
  ➜ 671▕             throw new QueryException(
    672▕                 $query, $this->prepareBindings($bindings), $e
    673▕             );
    674▕         }
    675▕ 

I also created a database using Sequel Pro on my mac but when i create a database i am not sure if it has been created the way it is suppose to be.

The settings for which are:

host id: 127.0.0.1
username: root

The settings in .env are:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
Akansha
  • 11
  • 1
  • 2
  • https://stackoverflow.com/questions/10169960/mysql-error-1449-the-user-specified-as-a-definer-does-not-exist – Felippe Duarte Nov 09 '20 at 15:30
  • Odd that it's trying to use `mysql.infoschema` as the user. If you're on a linux or Mac machine, try this from the root directory to see where that string is coming from: `grep -R 'mysql.infoschema' * .*` – aynber Nov 09 '20 at 15:34
  • output : ./storage/logs/laravel.log:[2020-11-10 09:23:34] local.ERROR: SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY000): SQLSTATE[HY000]: – Akansha Nov 10 '20 at 09:25
  • General error: 1449 The user specified as a definer ('mysql.infoschema'@'localhost') does not exist (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE') at /Users/akansha/Desktop/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671) – Akansha Nov 10 '20 at 09:27

2 Answers2

1

Try again after clearing the configuration, application, and view cache one by one with the three commands below:

php artisan config:clear
php artisan cache:clear
php artisan view:clear

Finally, repeat the migrate command:

php artisan migrate
Karl Hill
  • 12,937
  • 5
  • 58
  • 95
0

I trying make migrate so again and again and again so just look file .env and disable comment DB_HOST= mysql and enable DB_HOST=127.0.0.1 now again try and put terminal php artisan migrate so look everything ok !