migrations file are not being created in laravel - php

I am trying to create a user table on my database, i type in composer:
C:\Users\Dell\proTest>php artisan make:migration users
Created Migration: 2017_04_30_195825_users
my .env file db, db username and pass are the same as my db created on my localhost, same with database.php file.
The problem is that it says that the migration has been created, but when i go on my laravel project files database/migrations I can not find the file ?
I have been trying to google the issue for several hours, I did clear the project cache, i did created a new project still not working! Any suggestion ?
when i run php aritsan migrate i get this error
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrat
ions)
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrat
ions)

If the database infos are the same on .env file as well as database.php. I am pretty sure your laravel path its not the same as the editor's path.

run:
C:\Users\Dell\proTes php artisan migrate
migration files can be here:
C:\Users\Dell\proTes\database\migrations

Related

Can not create migration (Laravel Framework 9.17.0)

I want to connect the MySQL database to the Laravel project without XAMPP (Using Ubuntu 22.04).
I created a database called my_project and added it to.env file
Up next to create migrations I used artisan command: php artisan migrate.
As an output it returned
SQLSTATE[HY000] [1698] Access denied for user 'root'#'localhost' (SQL: select * from information_schema.tables where table_schema = my_database and table_name = migrations and table_type = 'BASE TABLE')
Any ideas what I might be doing wrong?
Apparently, my dad found the answer to my problem :D
problem was in giving my database user grant only for localhost.
However, it needs to be granted so it can be connected from any IP.
CREATE USER 'amir'#'%' IDENTIFIED BY 'password';
You can try cleaning the cache by doing
php artisan config:cache
php artisan config:clear
php artisan cache:clear

I am trying to migrate the table I have created but I keep getting an error that my database is unknown.I use XAMPP 3.3

SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
found this somewhere and it was helpful
The DB_USERNAME should be set to root if you do not have a default username
If no password is set on the database, clear it DB_PASSWORD
After completion of .env edit must be clear cache: php artisan config:cache
After Run the migrate Artisan command: php artisan migrate

SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: YES) (SQL: select * from `cats`)

I am building a basic CRUD app using Laravel 7 Homestead in a Vagrant VM. The root address http://crud-app.local.test works, but when I add a defined route (http://crud-app.local.test/cats) I get this error page:
Error message in browser when navigating to '/cats' route.
So far I have:
Verified my MySQL password matches in the .env file and in practice
Changed the MYSQL password so that it's no longer empty (and made sure it matches what's in the .env file)
Ran php artisan config:cache
Ran php artisan config:clear followed by php artisan cache:clear
Changed 127.0.0.1 to localhost
Made sure the database defined in the .env file exists (crud)
Ran php artisan migrate (no errors, and the cats table exists in the crud database)
Restarted and re-provisioned the machine (vagrant reload --provision)
I'm at a loss now.
Make sure that you give "root" permissions to read from the database that you've created. As it's root#localhost rather than root#127.0.0.1 sometimes mysql differentiates. Just check the permissions that root#localhost has for the database and if you update them, flush the privileges.

Laravel 7 - migrate:refresh got access denied

I start to work on a laravel project that start by colleage. once I pulled down the git I want to do migration:
php artisan migrate:refresh
Immediately I got an error:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'172.19.0.1'
(using password: NO) (SQL: SHOW FULL TABLES WHERE table_type = 'BASE
TABLE')
which seems odd because I checked all my config/database.php, .env, all point to 127.0.0.1 for mysql and not sure where 172.19.0.1 come from.
How can I debug this?
Please check your database, you have permissions issue for the database user.
Grant permissions for your db user root.
Execute the below command:
GRANT ALL PRIVILEGES ON dbname.* TO 'root'#'172.19.0.1';
FLUSH PRIVILEGES;

Laravel using vagrant: php artisan migrate --seed giving errors [duplicate]

This question already has answers here:
MySQL connection not working: 2002 No such file or directory
(23 answers)
Mysql localhost != 127.0.0.1?
(4 answers)
Closed 2 years ago.
homestead version: 9.2.0
vagrant version: 2.2.7
php version: 7.2.21
mysql version: 8.0.18
I created a new laravel project. I created a database called tickets. I've added the third party code from https://github.com/creativetimofficial/material-dashboard-laravel. When I get to step where you run "php artisan migrate --seed" I'm getting two different errors depedning on how I set db port in .env file.
Here's a picture of my db users and their hosts.
when DB_HOST=127.0.0.1 and I run the artisan migrate I get an error saying Connection refused. I only tried using 127.0.0.1 because I saw online people saying to use this instead of localhost. Since the connection is refused I have a feeling this isn't correct.
When DB_HOST=localhost and I run artisan migrate I get an error saying
No such file or directory (SQL: select * from information_schema.tables where table_schema = tickets and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = tickets and table_name = migrations and table_type = 'BASE TABLE') at /Applications/MAMP/htdocs/ticket-dashboard/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669)
Questions:
1) should I be using the IP instead of localhost and if so why do I get connection refused with using the IP?
2) If using localhost is fine, what needs to be fixed to bypass this error?
I've been testing everything I can find online to help, but this is the closest I've gotten. Any advice or ideas would be greatly appreciated

Categories