如何允许远程连接到mysql [英] How to allow remote connection to mysql
问题描述
我已经在本地计算机上安装了MySQL Community Edition 5.5,并且希望允许远程连接,以便可以从外部源进行连接.
I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source.
我该怎么做?
推荐答案
MySQL默认情况下允许.
That is allowed by default on MySQL.
默认情况下禁用的是远程root
访问.如果要启用它,请在本地运行此SQL命令:
What is disabled by default is remote root
access. If you want to enable that, run this SQL command locally:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
然后在您的my.cnf
文件(通常位于Unix/OSX系统上的/etc/mysql/my.cnf
上)中找到以下行并对其进行注释.在某些情况下,文件的位置是/etc/mysql/mysql.conf.d/mysqld.cnf).
And then find the following line and comment it out in your my.cnf
file, which usually lives on /etc/mysql/my.cnf
on Unix/OSX systems. In some cases the location for the file is /etc/mysql/mysql.conf.d/mysqld.cnf).
如果是Windows系统,则可以在MySQL安装目录中找到它,通常为C:\Program Files\MySQL\MySQL Server 5.5\
之类,文件名将为my.ini
.
If it's a Windows system, you can find it in the MySQL installation directory, usually something like C:\Program Files\MySQL\MySQL Server 5.5\
and the filename will be my.ini
.
换行
bind-address = 127.0.0.1
到
#bind-address = 127.0.0.1
然后重新启动MySQL服务器( Unix/OSX 和
And restart the MySQL server (Unix/OSX, and Windows) for the changes to take effect.
这篇关于如何允许远程连接到mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!