1044/1045 - Access denied for user 'username'@'yourhost'...
Apply OS: Windows, macOS, Linux, iOS
Apply Navicat Product: Navicat for MySQL, Navicat for MariaDB, Navicat Premium
Apply Navicat Version No.: All
The error returned by your remote MySQL server indicated that your user account has no enough privilege in order to connect with the server.
After MySQL database was installed, it would only allow "localhost" connection by default. Therefore, most server-side scripts program can easily connect with the local database in the same server. Any client computers will be blocked by the remote MySQL server until the user privileges has been configured.
If you want to access your remote MySQL server from your desktop, you would firstly need to know how MySQL privileges system works. Information about user privileges is stored in the user, db, host, tables_priv, and columns_priv tables in the mysql database (that is, in the database named mysql). The MySQL server reads the contents of these tables when it starts up.
MySQL access control would involve two stages:
- The server checks whether your desktop (host address or IP address) is allowed to connect.
- Assuming you can connect, the server checks each request you issue to see whether you have sufficient privileges to perform it. For example, Create table privilege, Drop table privilege or Alter table privilege.
MySQL server uses the User, Db, and Host tables in the MySQL database during both stages of access control.
If your remote server supports SSH connection, your Navicat will be able to connect with remote MySQL databases through SSH tunnel without making any changes to existing MySQL privileges setting. The major benefit of SSH tunneling is that it allows us to connect to a MySQL server from behind a firewall when the MySQL server port is blocked.
You can run the following command in your MySQL server command prompt. Please consult with your database administrator as they usually will have administration right to set the privilege.
GRANT ALL PRIVILEGES ON *.* TO 'YourUserName'@'%' IDENTIFIED BY "YourPassword";
GRANT ALL PRIVILEGES ON *.* TO 'YourUserName'@'YourIP' IDENTIFIED BY "YourPassword";