MySQL: How to allow remote connection to mysql(MySQL:如何允许远程连接到 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
文件中找到以下行并注释掉,该文件通常位于 /etc/mysql/my.cnf
在 Unix/OSX 系统上.在某些情况下,文件的位置是/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,以及 Windows) 以使更改生效.
And restart the MySQL server (Unix/OSX, and Windows) for the changes to take effect.
这篇关于MySQL:如何允许远程连接到 mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL:如何允许远程连接到 mysql


- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01