In this scenario, MySQL Community Edition 5.5 has been installed locally, and the objective is to facilitate remote connections for external access.
By default, MySQL permits remote connections, but remote root access is disabled. To enable it, execute the following SQL command locally:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;
Additionally, locate the following line in the my.cnf file (usually found in /etc/mysql/my.cnf on UNIX/macOS systems; check /etc/mysql/mysql.conf.d/mysqld.cnf for alternate locations):
bind-address = 127.0.0.1
Comment it out by adding a hash symbol ('#') at the beginning of the line:
#bind-address = 127.0.0.1
Windows users can find the my.cnf file in the MySQL installation directory, typically similar to C:Program FilesMySQLMySQL Server 5.5. Rename it to my.ini.
Restart the MySQL server on all platforms for the changes to take effect.
The above is the detailed content of How Can I Enable Remote MySQL Connections?. For more information, please follow other related articles on the PHP Chinese website!