問題描述
我在本地機(jī)器上安裝了 MySQL Community Edition 5.5,我想允許遠(yuǎn)程連接,以便我可以從外部源連接.
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 默認(rèn)允許這樣做.
That is allowed by default on MySQL.
默認(rèn)禁用的是遠(yuǎn)程root
訪問.如果要啟用它,請?jiān)诒镜剡\(yùn)行此 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
文件中找到以下行并注釋掉,該文件通常位于 /etc/mysql/my.cnf
在 Unix/OSX 系統(tǒng)上.在某些情況下,文件的位置是/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系統(tǒng),可以在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 服務(wù)器(Unix/OSX,以及 Windows) 以使更改生效.
And restart the MySQL server (Unix/OSX, and Windows) for the changes to take effect.
這篇關(guān)于MySQL:如何允許遠(yuǎn)程連接到 mysql的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!