Home > Database > Mysql Tutorial > How Can I Enable Remote MySQL Connections?

How Can I Enable Remote MySQL Connections?

Barbara Streisand
Release: 2024-12-23 17:47:10
Original
604 people have browsed it

How Can I Enable Remote MySQL Connections?

Achieving Remote MySQL Connectivity

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;
Copy after login

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
Copy after login

Comment it out by adding a hash symbol ('#') at the beginning of the line:

#bind-address = 127.0.0.1
Copy after login

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!

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