配置远程连接MySQL数据库
2017-05-17 15:28
447 查看
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44086869
使用MySQL远程连接软件(MySQL-Front),远程连接报错:
![](http://img.blog.csdn.net/20150305202021522?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHVhbmd5YW5sb25n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
[root@master ~]# mysql -u root@localhost
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
解决远程无法连接:
[root@master ~]# 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)
username client IP password
mysql> grant all privileges on *.* to root@"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)
再次远程登陆,成功连接了,如下图:
![](http://img.blog.csdn.net/20150305202136044?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHVhbmd5YW5sb25n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44086869
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44086869
使用MySQL远程连接软件(MySQL-Front),远程连接报错:
[root@master ~]# mysql -u root@localhost
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
解决远程无法连接:
[root@master ~]# 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)
username client IP password
mysql> grant all privileges on *.* to root@"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
相关文章推荐
- 配置phpmyadmin连接远程 MySQL数据库
- 配置phpmyadmin连接远程 MySQL数据库
- 配置phpmyadmin连接远程 MySQL数据库
- 【配置】sqlyog远程连接mysql数据库
- 安装MySQL先复制1. Linux (CentOS 7.3) 下快速安装Mysql数据库(安装教程)2.后复制阿里云配置 MySQL 远程连接的详细步骤
- 配置phpmyadmin连接远程 MySQL数据库
- linux配置mysql数据库远程连接失败的解决方法
- 配置Mysql数据库支持远程连接等操作的步骤
- MySQL数据库的远程连接配置
- 配置远程连接mysql数据库 Connect to remote mysql database
- 配置phpmyadmin连接远程 MySQL数据库
- linux配置mysql数据库远程连接失败
- [mysql]腾讯云 ubuntu 远程连接mysql数据库配置
- 远程地址无权限连接Mysql数据库,如何配置
- wampserver中的phpmyadmin 连接远程MySQL数据库配置
- 配置远程连接MySQL数据库
- 配置phpmyadmin连接远程 MySQL数据库
- Ubuntu下配置Tomcat服务器 mysql数据库并在windows中使用sqlyog 远程连接
- MySQL数据库的远程连接配置
- 用VNC远程图形化连接Linux桌面的配置方法