Home > Database > Mysql Tutorial > How to Fix MySQL Remote Connection Error 1045: Access Denied?

How to Fix MySQL Remote Connection Error 1045: Access Denied?

Linda Hamilton
Release: 2024-12-20 17:29:20
Original
569 people have browsed it

How to Fix MySQL Remote Connection Error 1045: Access Denied?

Remote MySQL Connection Error: Access Denied (1045)

To enable remote connections to a MySQL server, certain configurations must be in place. Let's investigate the issue you're facing and provide a solution.

Problem: When attempting to connect to MySQL remotely from a different IP address, you receive the error "ERROR 1045 (28000): Access denied for user 'root'@'192.168.233.163'". This suggests that remote connections are currently not allowed for the specified user or from the remote IP address.

Solution:

  1. Grant Permissions: As the root user, execute the following commands:

    • GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.233.163' IDENTIFIED BY 'redacted' with grant option;
    • FLUSH PRIVILEGES;
  2. Restart MySQL: To apply the changes, restart the MySQL server.

Alternatively, you can replace the % entry for the user root in the mysql.user table with a specific IP address. Ensure that the IP address used corresponds to the remote machine from which you want to connect.

Note: Remember to replace 'redacted' with the actual password and 192.168.233.163 with the appropriate IP address. Also, replace *.* with the database and table permissions you wish to grant.

The above is the detailed content of How to Fix MySQL Remote Connection Error 1045: Access Denied?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template