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;
Related
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 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.
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
I know the title looks familiar but no. I was working on a web app, and when I ran it, it says: Access denied for user 'root'#'localhost' (using password: NO). I searched some sites and they said that I should use a password. So I changed the password using mysql console. Than I got this message Access denied for user 'root'#'localhost' (using password: YES). And when I reenter the mysql console and put the password it makes a beep than it is closed. I got this event log:
Log Name: Application
Source: .NET Runtime
Date: 10/18/2015 7:12:51 PM
Event ID: 1026 Task Category: None Level: Error Keywords:
Classic User: N/A Computer: TOSHIBA-TOSH Description:
Application: MySQLWorkbench.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.Remoting.RemotingException Stack: at
System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object)
at
MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String)
at
MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String,
System.String[],
System.EventHandler`1)
at MySQL.GUI.Workbench.Program.Main(System.String[])
Event Xml:
1026
2
0
0x80000000000000
537897
Application
TOSHIBA-TOSH
Application: MySQLWorkbench.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled
exception. Exception Info: System.Runtime.Remoting.RemotingException
Stack: at
System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object)
at
MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String)
at
MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String,
System.String[],
System.EventHandler`1<MySQL.Workbench.InstanceCallbackEventArgs>)
at MySQL.GUI.Workbench.Program.Main(System.String[])
Any help ? I uninstalled everything (wamp, mysql, dreamweaver,.........) but still got the same problem. And mysql workbench give this error when i enter the password .
I tried to use config.inc.php solutions but still the same.
Please follow below steps:
Go to mysql server console and follow below steps:
Step1: open your config file and add below lines in [mysqld] section and save file.
skip-grant-tables
skip-networking
Step2: Restart your mysql service, you can use below command if using linux.
service mysqld restart
Step3: Now connect mysql by below command-
mysql -uroot
Step4: Above command will connect you with mysql and will show mysql prompt like below-
mysql>
Step5: Now change root password as per below-
mysql> update mysql.user set password = password('root123') where user='root';
OR
mysql> update mysql.user set password = password('root123') where user='root' and host = 'localhost';
mysql> flush privileges;
mysql> exit;
Step6: Now remove newly added lines from config file and restart mysql service again as per step2.
Finally now you can connect your web or phpmyadmin with root user.
Maybe root from localhost has not the required grant to access the DB.
Try to run the following on a mysql console:
GRANT ALL ON <yourdb>.* TO 'root'#'localhost';
FLUSH PRIVILEGES;
I am currently getting an error when I do my database migration with artisan with the command
sudo php artisan migration
I then get the following error:
SQLSTATE[28000][1045] Access denied for user 'root'#'localhost' (using password: NO).
I don't know where I would be able to reset the password or how and I have been looking for quite some time now. Any advice would be great. I am running this in a vagrant box. Thank you.
Edit your app/config/database.php file