Home > Database > Mysql Tutorial > How to Allow Remote Connections to My MySQL Database?

How to Allow Remote Connections to My MySQL Database?

Linda Hamilton
Release: 2024-12-31 10:41:15
Original
272 people have browsed it

How to Allow Remote Connections to My MySQL Database?

How to Enable Remote MySQL Connectivity

Introduction

Remote connectivity to MySQL allows external sources to establish connections with your local database. By default, remote connections are disabled, particularly for root users. This article provides a detailed solution to enable remote MySQL connections.

How to Enable Remote Connections

1. Grant Access for Remote Users

  • Execute the following SQL command locally:

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
    Copy after login
  • Run this command:

    FLUSH PRIVILEGES;
    Copy after login

2. Edit my.cnf File

  • Locate the my.cnf file (typically in /etc/mysql/my.cnf on Unix/OSX or C:Program FilesMySQLMySQL Server 5.5my.ini on Windows).
  • Find the line:

    bind-address = 127.0.0.1
    Copy after login
  • Comment it out by adding a "#" at the beginning of the line:

    #bind-address = 127.0.0.1
    Copy after login

3. Restart MySQL Server

  • Restart the MySQL server by stopping and starting it to apply the changes.

The above is the detailed content of How to Allow Remote Connections to My MySQL Database?. 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