Home > Database > Mysql Tutorial > How Can I Grant Remote Access to My MySQL Server?

How Can I Grant Remote Access to My MySQL Server?

Linda Hamilton
Release: 2025-01-04 00:47:40
Original
359 people have browsed it

How Can I Grant Remote Access to My MySQL Server?

Granting Remote Access Permissions to MySQL Server

While SHOW GRANTS may reveal remote access permissions restricted to localhost for the root user, there are methods to extend these permissions beyond the local machine.

Granting Permissions by Hostname:

To grant root access from any machine within the domain *.example.com, execute the following:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%example.com' 
IDENTIFIED BY 'some_characters' 
WITH GRANT OPTION;
FLUSH PRIVILEGES;
Copy after login

Granting Permissions by IP Address:

Alternatively, access can be restricted by IP or subnet:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%'
    IDENTIFIED BY 'some_characters'  
    WITH GRANT OPTION;
FLUSH PRIVILEGES;
Copy after login

Refer to MySQL's GRANT syntax documentation for further details.

The above is the detailed content of How Can I Grant Remote Access to My MySQL Server?. For more information, please follow other related articles on the PHP Chinese website!

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