Home > Database > Mysql Tutorial > How Can I Grant Remote MySQL Database Access from Any IP Address?

How Can I Grant Remote MySQL Database Access from Any IP Address?

Barbara Streisand
Release: 2024-12-16 10:45:12
Original
402 people have browsed it

How Can I Grant Remote MySQL Database Access from Any IP Address?

Granting Remote Access to MySQL Database from Any IP Address

To grant remote access to your MySQL database from any IP address, you can use the following modified command:

GRANT ALL PRIVILEGES
ON database.*
TO 'user'@'%'
IDENTIFIED BY 'newpassword';
Copy after login

By replacing the specific remote host ('yourremotehost') with the wildcard '%', you grant access to all remote hosts. The '%' symbol serves as a placeholder, indicating that any hostname or IP address is allowed to connect.

For additional flexibility, you can also grant access to specific domains or IP ranges by replacing '%' with the appropriate string:

  • '%.domain.example' grants access to all hosts within the "domain.example" domain.
  • '%.123.123.123' grants access to all hosts with IP addresses ending in "123.123.123".

By using wildcards or specific patterns, you can control the level of access granted to remote hosts, ensuring that only authorized entities can access your MySQL database.

The above is the detailed content of How Can I Grant Remote MySQL Database Access from Any IP Address?. 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