AboMohsen
AboMohsen

Reputation: 109

PHP artisan migrate not works

this is my config details - it's 100% correct

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=bglee
DB_USERNAME=root
DB_PASSWORD=

the migrate file

Schema::create('users', function (Blueprint $table) {
            $table->char("name" , 80);
            $table->char("username" , 50)->primary();
            $table->char("email" , 50)->unique();
            $table->char("password",50);
            $table->char("phone",25)->unique();
            $table->char("country",40)->nullable();
            $table->char("government",40)->nullable();
            $table->char("area",40)->nullable();
            $table->string("address")->nullable();
            $table->char("floor",20)->nullable();
            $table->char("apart",20)->nullable();
            $table->char("gender",10)->nullable();
            $table->integer("byear")->nullable();
            $table->integer("bmonth")->nullable();
            $table->integer("bday")->nullable();
            $table->char("aphone",25)->nullable();
            $table->integer("points")->default(0);
            $table->timestamps();
        });

the PHP artisan migrate always fire these errors

PDOException::("SQLSTATE[HY000] [1049] Unknown database 'bglee'")

I use the last version of laravel

the database name is correct and exist

enter image description here

Upvotes: 0

Views: 151

Answers (3)

AboMohsen
AboMohsen

Reputation: 109

SOLVED

I will not be able to explain logical reasons which made this issue occurs

I was using PhpMyAdmin through MAMP and the local host which generated from this command : php artisan serve - my project folder was in the desktop

now I used PhpMyAdmin through XAMPP and changed the MySQL port to 3333 and also the port variable in the .env file to 3333 , also moved the project folder to XAMPP htdocs folder .. done

Sorry - I can't understand why this issue happened

Upvotes: 0

Murugesan Rathinam
Murugesan Rathinam

Reputation: 158

Check whether database create or not.

And then check configuration details and .env without trailing space . app/config/database.php

Finally Clear cache,config and view

Upvotes: 0

bipin patel
bipin patel

Reputation: 2111

If you use vagrant than just try this step

  • vagrant ssh
  • cd /var/www/yourproject
  • php artisan migrate

Upvotes: 0

Related Questions