Home >Database >Mysql Tutorial >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;
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;
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!