配置远程连接MySQL数据库

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44086869

使用mysql远程连接软件(MySQL-Front),远程连接报错:

[[email protected] ~]# mysql -u [email protected]

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>quit

解决远程无法连接:

[[email protected] ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select user,password,host from user;

--需要将远程访问主机的IP添加进去

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

| user | password                                  | host            |

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

| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost       |

| root | *D997577481B722A2996B58BCE11EF3C312AC0B89 | master.cloudera |

| root |                                           | 127.0.0.1       |

|      |                                           | localhost       |

|      |                                           | master.cloudera |

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

5 rows in set (0.00 sec)

mysql> grant all privileges on *.* to [email protected]"10.53.105.221" identified by "root";

--赋予IP地址为10.53.105.221主机拥有所有权限(其中包括远程访问、远程操作权限)

Query OK, 0 rows affected (0.04 sec)

mysql> flush privileges;

--重新加载权限设置

Query OK, 0 rows affected (0.05 sec)

mysql> select user,password,host from user;

--再次查询,IP为10.53.105.221主机已经添加到host文件中

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

| user | password                                  | host            |

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

| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost       |

| root | *D997577481B722A2996B58BCE11EF3C312AC0B89 | master.cloudera |

| root |                                           | 127.0.0.1       |

|      |                                           | localhost       |

|      |                                           | master.cloudera |

| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 10.53.105.221   |

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

6 rows in set (0.00 sec)

再次远程登陆,成功连接了,如下图:

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44086869

时间: 2024-08-06 05:30:13

配置远程连接MySQL数据库的相关文章

配置远程连接mysql数据库 Connect to remote mysql database

设有本地机器(local machine), ip地址为localip 远程机器(remote machine), ip地址remoteip 要通过在local machine的终端连接remote machine的mysql数据库,并且对数据库进行操作. 1.在local和remote均安装好mysql,安装方法参考另一篇博客. 2.在本地ssh连接到远程host $ ssh [email protected] 3.打开远程host的mysql,为local添加用户. $ mysql -uro

Windows操作系统下远程连接MySQL数据库

用Eclipse做一个后台项目,但是数据库不想放在本地电脑,于是买了一个腾讯云服务器(学生有优惠,挺便宜的),装上MySQL数据库,但是测试连接的时候,发现总是连接不是上,但是本地数据库可以连接,于是上网搜索发现,mysql 数据库默认的连接只能在本机连接,远程连接必须授权. 远程连接权限配置: 进到你的MySQL\MySQL Server 5.5\bin文件夹下(注:Windows操作系统下doc命令进入) C:\Program Files\MySQL\MySQL Server 5.5>cd

Windows7下PL/SQL配置远程连接Oracle数据库

PL/SQL Developer是一个集成开发环境,专门开发面向Oracle数据库的应用.同时,PL/SQL也是一种程序语 言,叫做过程化SQL语言(Procedural Language/SQL).PL/SQL是Oracle数据库对SQL语句的扩展.在普通SQL 语句的使用上增加了编程语言的特点.PL/SQL只有Oracle数据库有,Mysql目前不支持PL/SQL. 由于工作关系,最近需要操作SQL语句,数据库是Oracle10g.操作数据库总不能直接在服务器上操作吧,一般都是 远程,所以找

Navicat for mysql 远程连接 mySql数据库10061、1045错误

用navicat连接远程的mysql数据报错: 有朋友可能会碰到使用Navicat for mysql 远程连接 mySql数据库会提示10061.1045错误或 2003-Can't connect to MySQL on '192.168.1.2'(10061),这个原因是因为MySQL不准许远程连接. 最简单的办法是 MySQL远程配置 代码如下 复制代码 GRANT ALL PRIVILEGES ON *.* TO [email protected]'%' IDENTIFIED BY '

navcat无法远程连接mysql数据库解决办法

navcat无法远程连接mysql数据库,一般都是因为本地ip没有访问权限,服务器上执行下面指令即可解决 mysql -u root -p GRANT ALL PRIVILEGES ON *.* TO 'mysql数据库用户名'@'本地ip' IDENTIFIED BY 'mysql数据库密码' WITH GRANT OPTION; flush privileges;

Navicat for mysql 远程连接 mySql数据库10061、1045错误问题 (转)

远程使用Navicat for mysql 客户端软件连接 mySql数据时,连接出现 2003-Can’t connect to MySQL on ’192.168.1.2’(10061)错误时,是由于MySQL不准许远程连接. 修改方法如下: 1:在服务端MySQL文件夹下找到my.ini文件.修改bind-address=127.0.0.1 为 bind-address=0.0.0.0 (在MySQL 5的my.ini中未发现此项) 2:重新启动MySQL服务. 测试连接情况: 如果没有给

用MyEclipse10.0远程连接Mysql数据库服务器

说明:本文档所有的操作均在满足以下条件的情况下操作, A.远程Linux服务器已经安装好MySQL数据库 B.本地电脑可以ping通远程服务器 C.已经成功安装了Myeclipse 一.下载mysql-connector-java-3.1.14-bin.jar 这个是连接mysql数据库的驱动器. 下载地址: http://dev.mysql.com/downloads/connector/j/5.0.html 也可以到官方网站下载,网址如下:www.mysql.com 二.在Myeclipse

Navicat for mysql 远程连接 mySql数据库10061错误问题

测试连接情况: 如果没有给远程登录用户添加所有机器都能访问的权限,将会出现“1045-Access denied for user ‘[email protected](using password:NO)”,这表明需要添加权限: 添加命令如下: 1 grant all on *.* to 用户名@"%" identified by "密码"; 2 flush privileges; 完成以上步骤,就可以远程访问MySQL数据库了.

Linux系统下实现远程连接MySQL数据库的方法教程

1.在服务器端开启远程访问首先进入mysql数据库,然后输入下面两个命令: grant all privileges on *.* to 'root'@'%' identified by 'password';flush privileges;第一个*是数据库,可以改成允许访问的数据库名称第二个 是数据库的表名称,代表允许访问任意的表root代表远程登录使用的用户名,可以自定义%代表允许任意ip登录,如果你想指定特定的IP,可以把%替换掉就可以了password代表远程登录时使用的密码,可以自定