A workaround for setting mysql to allow external IP connections

The solution to setting mysql to allow external IP connections mysql By default, only localhost connections are allowed. If you need external IP connections to mysql, you need to add relevant authorization to the "user" table in the mysql database. For example: let the root user use the root password to link to the mysql server from the IP: 192.168.1.100 host. Specific steps:

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY 'root' WITH GRANT OPTION; 
mysql>flush privileges; 

Grant syntax: grant permission name (all permissions are used) on library name (*all). Table name (*all) to 'user name to be authorized'@'%'(% means all IPs, you can only add one IP) identified by "password"; identity checks are performed using the 3 range columns of the user table (Host, User and Password). The server will only accept connections if the Host and User columns of the user table record match the client's hostname and username and the correct password is provided. How to specify the Host value in the user table: * The Host value can be a host name or IP number, or 'localhost' indicates the local host. * You can use wildcard characters "%" and "_" in the Host column value. * Host value '%' matches any host name, empty Host value is equivalent to '%'. Their meaning is the same as the pattern matching operation of the LIKE operator. For example, a Host value of '%' matches all hostnames, while '%.mysql.com' matches all hosts of the mysql.com domain.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325118478&siteId=291194637