Mysql Error Access denied for user
MySQL Error Access denied for user ‘user’@’localhost’ (using password: YES)“ in MySQL Server. When you try to login MySQL server from a remote host or locally. MySQL access denied for the localhost and can’t connect to the MySQL server.
To solve this issue, you will have to give grant permission for the user to access the database or log in remotely.
MySQL server won’t assign the permission to root user to access the database on localhost. you have to give permission to root to access the database.
This command will allow you to access the database
GRANT ALL PRIVILEGES On DATABASE.* TO ‘USER’@’IP ADDRESS’;
Check Out: Grant Permission On Database In Mysql
Grant Permission for remote login
GRANT ALL PRIVILEGES On DATABASE.* TO ‘USER’@’IP ADDRESS’ IDENTIFIED BY ‘PASSWORD’;
To make it work you will have to install the MySQL client on the server where from you’re trying to access the remote database server
Install MySQL Client by command
yum install mariadb mariadb-libs
Now try to login MySQL Server from a remote location. You will be accessible now.
mysql -h localhost -u username -p
You’re done mysql access denied localhost can’t connect to mysql