最近需要远程连接mysql服务器,先进行简单的测试,过程记录于此。

参考链接:

  http://blog.chinaunix.net/uid-28458801-id-3445261.html

  http://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111

本机ip: 192.168.1.248

远程ip: 192.168.1.249

mysql服务器配置

# 1.更改配置文件

#因为远程mysql服务器,设置只监听本地的端口,更改mysql配置文件,注释掉下面的一行。打开远程服务器的配置文件.
sudo vi /etc/mysql/my.cnf # 注释下面一行。
# bind-address = 127.0.0.1
# 如果没注释上面的一行,客户端连接时,会出现如下错误。
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.249' (111) # 2. 打开mysql服务
sudo service /etc/init.d/mysql start # 3. 配置mysql服务器
qt@tony:~/Desktop$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.53-0ubuntu0.12.04.1 (Ubuntu) Copyright (c) 2000, 2016, 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 # 允许用户的ip是192.168.1.248,使用用户名为 tony, 密码是 password进行登录。 mysql> grant all PRIVILEGES on *.* to tony@'192.168.1.248' identified by 'password';
Query OK, 0 rows affected (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec) mysql> quit
Bye

mysql客户端连接

# 连接出现错误。
# error1:
ERROR 1045 (28000): Access denied for user 'tony'@'aplex-2.local' (using password: YES)
# 我这边得情况是本地的ip没有配置,从新配置ip.
sudo ifconfig eth0 192.168.1.248. # 连接
# 以服务器设置的用户名登录
Qt@tony:~$ mysql -h 192.168.1.248 -u tony -p
Enter password:
# 或者以root用户登录
Qt@tony:~$ mysql -h 192.168.1.249 -u tony -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.53-0ubuntu0.12.04.1 (Ubuntu) Copyright (c) 2000, 2016, 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>

Tony Liu

2016-11-4, Shenzhen

ubuntu mysql 远程连接的更多相关文章

  1. ubuntu mysql 远程连接问题解决方法

    在shell下输入mysql -uroot -p是可以登录的,所以问题应该是mysql不允许root用户远程登录的问题,于是通过输入下面命令: GRANT ALL PRIVILEGES ON *.*  ...

  2. ubuntu允许mysql远程连接

    ubuntu允许mysql远程连接 第一步: vim /etc/MySQL/my.cnf找到bind-address = 127.0.0.1 注释掉这行,如:#bind-address = 127.0 ...

  3. Mysql远程连接配置

    Mysql远程连接配置 环境:unbuntu 16.04 最新版本的Mysql在远程连接的配置上与老版本有了一些出入,照原先的配置已经不行了,所以在这里记录一下遇到的所有新问题. 配置远程连接的步骤如 ...

  4. 在Ubuntu14.04中配置mysql远程连接教程

    上一篇文章,小编带大家学会了在Ubuntu14.04中安装MySQL,没有来得及上课的小伙伴们可以戳这篇文章:如何在Ubuntu14.04中安装mysql,今天给大家分享一下,如何简单的配置MySQL ...

  5. mysql远程连接命令

    mysql远程连接命令   一.MySQL 连接本地数据库,用户名为“root”,密码“123”(注意:“-p”和“123” 之间不能有空格) C:\>mysql -h localhost -u ...

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

    原文地址:http://www.111cn.net/database/mysql/46377.htm 有朋友可能会碰到使用Navicat for mysql 远程连接 mySql数据库会提示10061 ...

  7. mysql 远程连接速度慢的解决方案

    PHP远程连接MYSQL速度慢,有时远程连接到MYSQL用时4-20秒不等,本地连接MYSQL正常,出现这种问题的主要原因是,默认安装的MYSQL开启了DNS的反向解析,在MY.INI(WINDOWS ...

  8. mysql 远程连接

    4.现在如果用你电脑上的终端进行MySQL连接时,有可能出现如下错误: MySQL远程连接ERROR 2003 (HY000):Can't connect to MySQL server on'XXX ...

  9. 如何开启MYSQL远程连接权限

    开启MYSQL远程连接权限 //建议设置固定IP mysql> GRANT ALL PRIVILEGES ON *.* TO root@"8.8.8.8" IDENTIFIE ...

随机推荐

  1. COJ 拯救瑞恩

    试题描述 在n行n列的字符方阵中I表示“我”最初所在位置,R是大兵瑞恩所在位置.4<n<11.“我”从当前位置可以向上.或下.或左.或右移动一格,只要新点无障碍且未出界.标有“.”的位置可 ...

  2. COJ979 WZJ的数据结构(负二十一)

    试题描述 请你实现一个数据结构,完成这样的功能: 给你一个N个点的图,初始状态无边. 每次加入一条双向边(u,v,w),若加入后没有构成一棵生成树,输出“Not Yet”,否则输出当前最小生成树的权值 ...

  3. Windows7下面手把手教你安装Django

    我所使用的操作系统是Windows7,内存是2G 在搜索了一些资料发现,对于Django的安装,详细的真的很少,都说的很简化,然而,这篇blog可以手把手教你成功安装Django 对于Django的详 ...

  4. Idea_编译报错 javacTask: 源发行版 1.6 需要目标发行版 1.6

    在idea中编译时发生如下的错误 Information:Using javac 1.7.0_75 to compile java sources Information:java: javacTas ...

  5. (转)微信公众平台开发之基于百度 BAE3.0 的开发环境搭建(采用 Baidu Eclipse)

    原文传送门(http://blog.csdn.net/bingtianxuelong/article/details/17843111) 版本说明:     V1:         2014-2-13 ...

  6. QQ空间分享功能(二)

    http://sns.z.qq.com/tools/share/demo_html.jsp  手机QQ空间分享功能接入指引: 1.请求地址: http://sns.z.qq.com/share 2.请 ...

  7. SSH配置动态数据源

    用到一个项目,需要整合2个不同的数据库! 现将代码贴下,以备后用: 1.创建静态映射类,该类映射动态数据源 public class DataSourceMap { public static fin ...

  8. Odoo ir actions 分析

    源代码位置:openerp/addons/base/ir/ir_actions.py 根类型:ir.actions.actions class actions(osv.osv): _name = 'i ...

  9. 词频统计(WEB版)

    通过点击浏览按钮输入文件: 点击查询按钮后返回结果: 前台代码: <%@ Page Language="C#" AutoEventWireup="true" ...

  10. HDU 1003 基础dp 最大连续序列和

    常常做错的一道题.. 因为总是要有一个长度的 所以一开始的s与e都是1 maxx也是a[1] 然后再求 从i=2开始 在这里注意 me永远是当前i 而ms则可能留在原地 可能直接等于i 判断条件就是当 ...