i moved magento 1.9 from one server to another server, but it is not working giving error "SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'"

enter image description here

for admin panel it is showing url not found.

  • Did you manage to get it working as suggested in answer? Commented Jun 4, 2020 at 8:08

1 Answer 1


Your MySQL user (root) does not have localhost access to the database. (the server itself).

Firstly you need to login to mysql from the command-line with your root user:

mysql -u root -p -h IP.Address.Of.DB -P PortNumber

It is never a good idea to use the root user for db access! Create a new mysql user

  • You need to create a new MySQL user and grant access to the database: GRANT ALL PRIVILEGES ON newdbname.* TO 'username'@'localhost' IDENTIFIED BY 'password';

  • Also if you need to remotely access it, (for instance from a Mysql Client from your work desktop)

Specific IP only:
GRANT ALL PRIVILEGES ON newdbname.* TO 'username'@'ip';


Any IP:
GRANT ALL PRIVILEGES ON newdbname.* TO 'username'@'%';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.