mysql -u edge_user -p -h 127.0.0.1 -P 3306 edge_db and I got error 1698 (28000) access denied for user ... @localhos
The error message you're encountering, "1698 (28000): Access denied for user '...'@'localhost'," typically indicates that the MySQL server is rejecting the connection attempt due to authentication issues. Here are some steps you can take to troubleshoot and resolve this issue:
Check Username and Password:
User Privileges:
SHOW GRANTS FOR 'edge_user'@'localhost';
GRANT ALL PRIVILEGES ON edge_db.* TO 'edge_user'@'localhost' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
Host Specification:
-h 127.0.0.1
. MySQL treats 'localhost' and '127.0.0.1' differently due to the way it handles socket connections versus TCP/IP connections.SELECT host FROM mysql.user WHERE user = 'edge_user';
CREATE USER 'edge_user'@'127.0.0.1' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON edge_db.* TO 'edge_user'@'127.0.0.1';
FLUSH PRIVILEGES;
MySQL Authentication Plugin:
auth_socket
, which does not use passwords.mysql_native_password
if needed:
ALTER USER 'edge_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
MySQL Service:
Firewall and Network:
Log Files:
/var/log/mysql/
or /var/log/mysqld.log
.By following these steps, you should be able to identify and resolve the issue causing the "access denied" error.