最近需要远程连接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. [Unity2D]GameObject游戏对象的灵活运用

    Unity2D的游戏可以说是由一堆GameObject构成的,GameObject的使用非常灵活,不仅仅是给单个精灵使用,你可以发挥你一切的想象力来利用它来解决一些实际上的问题.比如: 1.给一个精灵 ...

  2. 【BZOJ】1036: [ZJOI2008]树的统计Count(lct/树链剖分)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1036 lct: (ps:为嘛我的那么慢T_T,不知道排到哪了..难道别人都是树剖吗...看来有必要学 ...

  3. Dijkstra堆优化与SPFA模板

    Dijkstra+优先队列 #include<cstdio> #include<cctype> #include<queue> #include<cstrin ...

  4. HttpClient_javax.net.ssl.SSLHandshakeException: sun.security.validator 问题解决,与环境有关

    用httpclient访问https 资源时,会出现异常,与环境也有关系,有些机器请求正常. javax.net.ssl.SSLHandshakeException: sun.security.val ...

  5. empty与isset的一点使用体会

    刚在做表单提交的时候,我想检验一下数据是否存在,并用var_dump函数看一下数据.首先看使用isset()的代码 //登录函数 function login(){ if(!isset($_POST) ...

  6. 仿5173游戏交易平台系统SQL注入(可直接脱裤)+Getshell

    最近没事登登好几年前玩过的游戏看看,发现有人喊高价收号,这一看就是骗子,这等骗子还想骗我?我就来看看这逗逼是怎么骗人的,结果发现这人给了一个说是 5173平台交易的网站,叫我直接把号的信息填上去然后填 ...

  7. redis 配置 linux

    附件 启动停止脚本 redis_6433: #/bin/sh #Configurations injected by install_server below.... EXEC=/usr/local/ ...

  8. NBOJv2 1004 蛤玮打扫教室(线段树区间更新区间最值查询)

    Problem 1004: 蛤玮打扫教室 Time Limits:  1000 MS   Memory Limits:  65536 KB 64-bit interger IO format:  %l ...

  9. 2016.04.28,英语,《Vocabulary Builder》Unit 20

    nom, comes from the Latin word for 'name'. nominee is 'named', [ˌnɑːmɪ'niː] n. 被提名的人, 名义人. binomial ...

  10. Javascript 笔记与总结(2-8)对象2

    注意:标签属性与 DOM 对象属性的对应关系,绝大部分 2 者是相同的,例如 imgobj.src 属性对应 <img src=""> 中的 src 属性 例外:< ...