I am getting this error. In codeigniter 2.1.3
Connection failed: Access denied for user 'root'#'localhost' (using password: YES)
I have tried hard.
I have done restart Apache and MySQL.
Tried with adding ip as hostname.
Have edited my.cnf file.
Related
From root user, I can execute this command without any problems:
[root#freebsd ~/var/html/www]$ bin/console d:run-sql 'SELECT * from user';
From www user, I cannot execute this command:
[www#freebsd ~/var/html/www]$ bin/console d:run-sql 'SELECT * from user';
because I am getting the following error:
An exception occurred in driver: SQLSTATE[HY000] [2002] Permission denied
Both users are using the same config file:
parameters:
database_driver: "pdo_mysql"
database_url: "mysql://dbuser:dbuserpass#127.0.0.1:3306/dbname"
I am using MariaDB 10.4 which is running on Freebsd with PHP(Symfony project)
Authentication problems comes with an access denied message.
A permission denied error means that you authentication happened but the resource you're trying to access was denied. Probably the dbname database.
You need to grant at least a "select" permission to this user with root or another administrator user:
GRANT SELECT ON dbname.* TO dbuser#127.0.0.1;
Pay attention because with mysql client if we don't specify a host or specify it like localhost instead of 127.0.0.1, the client tries to connect trought unix socket.
You can overcome this with --protocol tcp or using a IP address.
I was installing WHMCS on my wamp localhost but it required a password for the database which is blank by default, so I went in to phpmyadmin and added a password. Whenever I try to connect the database now I just get this error. Could not connect to database server: SQLSTATE[HY000] [1045] Access denied for user 'test'#'localhost' (using password: YES)
Screenshot of the installation page and error
I have my .env file configured with the remote DB credentials and its working on my local computer.
When I deploy the app to our dev server in the same page returns
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from `table_companies`)
Is there a command that I'm missing? Why if my .env us using our cloudways database credentials is saying homestead'#'localhost?
The production server has its own DB credentials that you should put in server's own .env file.
I am facing one problem on xampp
1045 - Access denied for user 'root'#'localhost' (using password: YES)
I have changed the password on the Config.inc file, but this doesn't resolved the issue.
I have the same problem with you, but I have resolved it.
I think you have input your default root password, we can't do it.
If you want to enter the mariadb, you should run mysql_secure_installation first to create your account for mariadb, and next run mysql -uroot -p 'your password'
I am trying to connect to mysql using PHP in ubuntu LAMP. I can login to phpmyadmin , but not able to connect using php code. The code was working well in XAMPP .
I am using the following code
$con=mysql_connect("127.0.0.1","myusername","mypassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
But it shows the following error
Could not connect: Access denied for user 'root'#'localhost' (using password: YES)
There is 3 (that i know of) posible solutions to this depending on the problem.
There is a firewall in ubuntu that you need to open, you do this by granting access in IPtables.
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
And now we should be able to login to our server from our local machine:
mysql -h255.112.324.12 -uroot -pMyPASSWORD
You need to grant access to mysql: https://askubuntu.com/questions/159053/mysql-server-not-accessible-from-remote-machine
as root, open your /etc/mysql/my.cnf with your favorite editor
look for the [mysqld] section, and in there for the bind-address keyword. This usually is set to 127.0.0.1 -- change that to match your "normal" IP-address
save the file, and reload the service (e.g. using service mysql restart)
Last but not least you need to give remote access in mysql:
GRANT ALL ON mydb.* TO root#'%' IDENTIFIED BY 'MyPASSWORD';
Source: http://web.archive.org/web/20120930214828/http://chosencollective.com/technology/how-to-enable-remote-access-to-mysql + Many sleepless nights.