mysql -u edge_user -p -h 127.0.0.1 -P 3306 edge_db and I got error 1698 (28000) access denied for user ...
The error message "Access denied for user" (error code 1698) indicates that the MySQL server is rejecting the connection attempt for the specified user. Here are some common reasons for this error and how to resolve them:
Incorrect Password: Ensure that you are entering the correct password for the edge_user
. If you are unsure, you may need to reset the password.
User Privileges: The user edge_user
may not have the necessary privileges to access the edge_db
database. You can check the user's privileges by logging in as a user with sufficient privileges (like root
) and running:
SHOW GRANTS FOR 'edge_user'@'127.0.0.1';
Host Mismatch: MySQL users are defined by both username and host. If edge_user
is defined for a different host (e.g., localhost
instead of 127.0.0.1
), you will get an access denied error. You can check the user definitions with:
SELECT User, Host FROM mysql.user WHERE User = 'edge_user';
Authentication Plugin: MySQL may be using a different authentication plugin that is not compatible with your connection method. For example, if edge_user
is set to use auth_socket
, you won't be able to log in with a password. You can check the authentication method with:
SELECT User, Host, plugin FROM mysql.user WHERE User = 'edge_user';
Firewall or Network Issues: Ensure that there are no firewall rules or network issues preventing access to the MySQL server on the specified host and port.
MySQL Server Configuration: Check the MySQL server configuration to ensure that it is set to allow connections from the specified host.
Reset Password (if needed):
ALTER USER 'edge_user'@'127.0.0.1' IDENTIFIED BY 'new_password';
Grant Privileges (if needed):
GRANT ALL PRIVILEGES ON edge_db.* TO 'edge_user'@'127.0.0.1';
FLUSH PRIVILEGES;
Change Authentication Plugin (if needed):
ALTER USER 'edge_user'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'your_password';
Check MySQL Logs: If the issue persists, check the MySQL error logs for more detailed information about the access denial.
After making any changes, try connecting again with the command you provided. If you continue to experience issues, please provide more details about the user setup and any relevant configurations.