如何解决server下mysql无法远程连接问题

    作者:课课家教育更新于: 2016-03-24 15:14:31

      常常在MySQL-server下我们会遇到ubuntuServer中LAMP下MySQL无法远程连接的问题,今天将给大家介绍如何解决这类问题。

      Ubuntuserver中,LAMP的配置时,我们常常会遇到MYSQL无法远程连接的问题。本文讲述的是:“10061Cannotconnecttomysqlerror10061”,“1130isnotallowedtoconnecttothisMySQLserver1130”这两个问题的解决。第二个问题:

      UbuntuServer中LAMP下MySQL无法远程连接该怎么办:

      MySQL无法远程连接问题10061、问题1130

      很常见的问题发生了,我们怎么处理它?

      环境:ubuntuServer(版本8.04以上对于LAMP应用都大同小异),cl@ubuntu.

      目的:安装LAMP重新配置RT系统。

      软件:服务器端已安装LAMP组件,MySQL5.1版本;客户端使用Navicat进行远程连接。

      问题②提示”isnotallowedtoconnecttothisMySQLserver”,如图2

    如何解决server下mysql无法远程连接问题_数据库_server服务器_课课家

      LAMP/MySQL/远程连接

      对于数据库的远程连接不外乎两方面入手:1、客户端至服务器端的连通性。2、服务器端没有合理配置。当然非要加上客户端也没有配置之类的,也尚可,比如ODBC的方式连接MySQL。

      ②当MySQL连接服务器时发生”isnotallowedtoconnecttothisMySQLserver”错误,我们要注意在MySQL的user表中修改host列的localhost为%,即可以远程连接。

      做如下操作:

      mysql>uSEMysql--切换数据库上下文

      Readingtableinformationforcompletionoftableandcolumnnames

      Youcanturnoffthisfeaturetogetaquickerstartupwith-A

      Databasechanged

      mysql>selecthost,user,passwordfromuser;--查询USER表

      +-----------+------------------+-------------------------------------------+

      

      +-----------+------------------+-------------------------------------------+

      |localhost|root|*MD5加密|

      |ubuntu|root|*MD5加密|

      |127.0.0.1|root|*MD5加密|

      |localhost|debian-sys-maint|*MD5加密|

      +-----------+------------------+-------------------------------------------+

      

      +-----------+------------------+-------------------------------------------+

      +-----------+------------------+-------------------------------------------+

     

      +-----------+------------------+-------------------------------------------+

      2rowsinset(0.00sec)

      注:如果在修改User时失误出现以下结果,怎么办?

      mysql>selecthost,user,passwordfromuser;

      +-----------+------------------+-------------------------------------------+

      |host|user|password|

      +-----------+------------------+-------------------------------------------+

      |ubuntu|root|*MD5加密|

      |localhost|debian-sys-maint|*MD5加密|

      +-----------+------------------+-------------------------------------------+

      2rowsinset(0.00sec)

      此时没有127.0.0.1和localhost主机,所以无法用root用户进行连接,会提示以下错误

     

      则此时只能用系统自带的debian-sys-maint用户登录,修改host。该用户的的登录密码在/etc/mysql/debian.cnf中明文显示。

      比如:

      做如下操作:

      

      清理思路,注意操作后需重启服务。

课课家教育

未登录