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

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

Linda Hamilton
Release: 2024-12-20 16:18:09
Original
753 people have browsed it

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

Granting Remote Access to MySQL Database from Any IP Address

When granting remote access to a MySQL database, the standard command typically specifies a specific IP address. However, if you wish to allow access from any remote host, a slight modification is required.

The revised command now grants privileges to a user with the wildcard '%' instead of a specific IP address:

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

By utilizing '%', the database is effectively made public, allowing access from any remote host. This character serves as a wildcard, enabling you to specify broader IP ranges or patterns, such as:

  • %.example.com: Allows access from any host within the "example.com" domain
  • %.123.123.123: Grants access from any host with the specified IP address prefix
  • %.: Provides unrestricted access from all IP addresses

The above is the detailed content of How Can I Grant Remote MySQL 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