Home  >  Article  >  Database  >  Ubuntu下MySQL不能远程登录的解决

Ubuntu下MySQL不能远程登录的解决

WBOY
WBOYOriginal
2016-06-07 16:52:49807browse

Q: 当在另一台机器上登录MySQL时出现如下错误:ERROR 2003 (HY000): Can

Linux公社

首页 → 数据库技术

背景:

阅读新闻

Ubuntu下MySQL不能远程登录的解决

[日期:2008-10-04] 来源:Linux社区  作者:Linux编辑 [字体:]

Q: 当在另一台机器上登录MySQL时出现如下错误:

ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (111)

A: 原因是MySQL考虑到安全因素,默认配置只让从本地登录

打开 /etc/mysql/my.cnf 文件,找到 bind-address = 127.0.0.1 修改为 bind-address = 0.0.0.0

重启mysql : sudo /etc/init.d/mysql restart

可参考:

> I've already check my /etc/my.cnf file for a "binding"
> line.  Its not
> there.  I also found an item online that indicated
> adding:
>

Look for the option "skip-networking". This disables TCP/IP so the
server only accepts local connections via the Unix socket. This sounds
like your situation.
Note that a "could not connect" error means just that. If the problem
was related to user privileges you would get an "access denied" error.

Q: 还一种情况出现类似下面的错误:

ERROR 1045 (28000): Access denied for user 'test'@'x.x.x.x' (using password: NO)

A: 原因是没有给登录用户名设置远程主机登录的权限。

在本地用 root 登录: mysql -u root -p

修改 MySQL 数据库中 user 表中 对应用户名的 Host 字段,,将 localhost 改为 %

use mysql;

update user set Host = '%' where User = 'username';

linux

  • 0
  • RHEL下安装MySQL

    Ubuntu 8.04下MySQL更改目录造成错误问题(datadir)的解决

    相关资讯       MySQL教程 

    图片资讯      

    本文评论   查看全部评论 (0)

    评论声明

    最新资讯

    本周热门

    Linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
    本站(LinuxIDC)所刊载文章不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。


    Copyright © 2006-2011 Linux公社 All rights reserved 浙ICP备06018118号

    Statement:
    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