Why won't Magento connect to the local database? - mysql

I copied my company's Magento website to my local machine in order to set up a development environmnet. However, when trying to view the page at 'localhost/html', I get the following connection error:
SQLSTATE[HY000] [1045] Access denied for user 'easyfair_eftest'#'localhost' (using password: YES)
I believe this is because the username is incorrect. However, I have already modified the local.xml file to use the correct username (app/etc/local.xml). Why is it still trying to connect using the old username?
I am using WAMP for my local environment.

Please try 127.0.0.1 in place of localhost.

Related

Can connect to remote mysql DB through mysql workbench but not through mysql2 (NodeJS)

I'm trying to connect my NodeJS application to my remote MySQL Database, but it keeps giving me a 1045 error ('ER_ACCESS_DENIED_ERROR'). From the same workstation, I can connect to the same database through MySQL Workbench perfectly fine.
This leads me to think that the problem was with my NodeJS setup, but copying the database to a local setup and then connecting it, worked just fine. For the sake of testing, I made a DB user with host: %, and from my Node app, I connect to the IP address where the database is hosted. I'm hosting it on my own Centos 7 droplet with my workstation IP whitelisted.
The error message I get is:
"Access denied for user '[the test user I made]'#'[workstation ip]' (using password: YES)"
Any help is much appreciated!
The following error:
"Access denied for user '[the test user I made]'#'[workstation ip]' (using password: YES)"
Usually indicates a wrong password.
Check that you wrote down the correct password and fix it if need be.
Also good to read about at this point is: https://dev.mysql.com/doc/internals/en/authentication-method.html
Apparently (atleast I think) the password I used, had forbidden characters in it (not sure which ones). Generating a simpler password solved the issue!

Access denied for user root#localhost on Ubuntu and OS X

I'm developing a web application and it is working just fine in Windows, but now I'm trying to run it in Ubuntu and in a Macbook and it's giving me a Access denied error.
The error doesn't allow me to retrieve information from the database, but let me enter the web application.
I can access to localhost/myApplication, but can't retrieve the database info.
The thing is that I can access the database if I change my code's hostname to 127.0.0.1, but I don't want to do that, I want to keep it as localhost.
I've tried everything I found around Internet, like:
I've changed my hosts file to listen to 127.0.0.1 localhost. I've granted all privileges to my user and flushed them. I've uninstalled and reinstalled Xampp and MySQL. I've changed my.cnf, php.ini, socket location and any other config files inside Xampp folder, but nothing worked.
The error it gives me and my code:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: YES)
My code:
$conn = new PDO("mysql:host=localhost;dbname=mydb", $db_user, $db_pass);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
I know that if I change localhost to 127.0.0.1 I can have access, but I want to keep it as localhost because I don't want to change all my other applications to listen to 127.0.0.1.

Error 1045 using password yes and restore data from wampserver

I have wamp running locally on my computer and was working just fine. I have a web application based on PHP and MySQL. I am using a password for the connection.
Suddenly, I got the following error:
MySQL ERROR 1045 (28000): Access denied for user 'root'#'localhost'
(using password: YES)
I tried to follow the answers of this post on stack. But nothing worked.
Ounce I open the mysql cmd and write down the password, it will close immediately.
I even used MySQL workbench, and I was successful to enter but on a different user with password. But the user I am using where my databases resides, is not accessible anymore.
I have a db called ncd, where I can see it on the other user but as empty.
Could I restore the data from wampserver ?
You can check your db on /mysql/ folder and them store it. And move to another mysql with another account and restore your db with same folder as above me talk it.

Remote access MySql via remote phpMyAdmin

I have a phpMyAdmin with MySQL on a linux remote machine to which I can connect with no problem with a browser.
But when I am trying to connect a DB in MySQL from a .NET program in my machine, I am getting an error message:
Authentication to host 'theIpNumber' for user 'newUserName' using method 'mysql_native_password' failed with message: Access denied for user 'newUserName'#'myMachineName' (using password: YES)
I tried to configured it like it is explained here: http://www.devside.net/wamp-server/accessing-mysql-or-phpmyadmin-from-outside
creating a new user with password in phpMyAdmin and changing the config.inc.php
Then in my app.config I have the connection string with:
connectionString="server=theIpNumber;UserId=newUserName;Password=newUserPassword;database=theDB"
But I am still getting the same error message when I run my program. Any idea how to solve this?
Finally I solved it adding in phpMyAdmin another user with the same name "newUserName" and password, and with the host value "%"

Unable to authenticate to mysql via vb.net

I have set up a MySQL server on Debian Linux and need to access a database on this server via vb.net. I found some help on Code Project to download the connector.net library and build a class to access the MySQL database. However when I try to connect I get the authentication error below when attempting to establish a connection with the mysql server:
Authentication to host '192.168.68.47' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'#'' (using password: YES)"} System.Exception
It seems that the library is appending the Windows workstation and domain to the user name and I am getting error. I tried using the root user with "#IPaddress" of the workstation, but it simply appended the workstation name and domain to this user. I also tried with another user besides root.
This is perfectly logic, because on your mysql server you need to Grant access to your host so it will be allowed to connect to, you can do it by following instructions in the following
Link
Also in the mysql configuration file, in your case : /etc/mysql/my.cnf you need to delete the line
bind-address = 127.0.0.1
This line will restrict all access from remote hosts, deleting it will allow access from remote hose which is what you want to do.
Hope this helps.