-1

I use Laravel When I try to access Localhost:8000 I get an error

    Illuminate\Database\QueryException
    SQLSTATE[HY000] [1049] Unknown database 'my_data' (SQL: select `title`,`id` from `table_8` where `id` = 24) 

I have a database called my_data in phpmyadmin

XAMPP\volumes\root\htdocs\project\.env

 _CONNECTION=mysql
 DB_HOST=127.0.0.1
 DB_PORT=3306
 DB_DATABASE= my_data
 DB_USERNAME=root
 DB_PASSWORD=
XAMPP\volumes\root\htdocs\project\config\database.php
  'mysql' => [
             'driver' => 'mysql',
             'url' => env('DATABASE_URL'),
             'host' => env('DB_HOST', '127.0.0.1'),
             'port' => env('DB_PORT', '3306'),
             'database' => env('DB_DATABASE', 'my_data'),
             'username' => env('DB_USERNAME', 'root'),
             'password' => env('DB_PASSWORD', ''),
             'unix_socket' => env('DB_SOCKET', ''),
             'charset' => 'utf8mb4',
             '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'),
             ]) : [],
         ],

I changed the DB_DATABASE to my_data in the .env file

And I ran the command

$php artisan cheat:clear

And yet the error is still the same error

    Illuminate\Database\QueryException
    SQLSTATE[HY000] [1049] Unknown database 'my_data' (SQL: select `title`,`id` from `table_8` where `id` = 24) 

I am use Mac

Shadow
  • 33,525
  • 10
  • 51
  • 64

1 Answers1

0

i think your username and password of phpmyadmin is wrong. please check it out. of different. fix it. and try again

Amir Khaledian
  • 109
  • 1
  • 4