sarah
sarah

Reputation: 61

why migration databases not working in laravel?

I am new with laravel and I want to migrate the table first I change .env information (database name, password,user name)and I made the model and write the proprieties but when I write the command php artisan migrate the tables did not appear in my phpmyadmin database and the following error appears:

SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge' 
(SQL: select * from information_schema.tables where table_schema = forge and 
table_name = migrations and table_type = 'BASE TABLE') catch (Exception $e) {
 > 664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), 
$e 666| ); 667| } ...

Upvotes: 1

Views: 2053

Answers (4)

monsieur_cs
monsieur_cs

Reputation: 21

try this:

  1. composer du.
  2. php artisan make:migration create_model_table.
  3. php artisan migrate.
    you must be sure that you entered the right db credintials.

Upvotes: 1

glydeDev
glydeDev

Reputation: 135

Make sure you create a blank database before running the migration.

I suggest you create new user and password in your sql and
GRANT ALL on <'name_of_your_database'>

Then update your .env file same as your database user credentials and migrate it.

Upvotes: 2

Mohammed Aktaa
Mohammed Aktaa

Reputation: 1353

If you run your project by php artisan serve turn it off and run it again. If not you need to check your credentials to your mysql

Upvotes: 0

Rajkumar Sharma
Rajkumar Sharma

Reputation: 584

Make sure you are running command in desire project. Have you created migration file for your model by

php artisan make:migration create_model_name

Update the column in migration file and then run

php artisan migrate

Upvotes: 0

Related Questions