安装好mysql后,想使用另一个电脑进行远程登录,在登录时 提示拒绝连接

百度后,发现需要两个步骤解决该问题

  • /etc/mysql/my.cnf 里修改bind_address = 0.0.0.0 
  •  进行授权

 (1)直接授权

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql>FLUSH RIVILEGES;

  (2)改表法 可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改成”%”

mysql -u root -p passwd
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
但是在进行第一步的时候,my.cnf里的内容却是如下这样的:
#

# The MySQL database server configuration file.

#

# You can copy this to one of:

# - "/etc/mysql/my.cnf" to set global options,

# - "~/.my.cnf" to set user-specific options.

# 

# One can use all long options that the program supports.

# Run program with --help to get a list of available options and with

# --print-defaults to see which it would actually understand and use.

#

# For explanations see

# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#

# * IMPORTANT: Additional settings that can override those from this file!

#   The files must end with '.cnf', otherwise they'll be ignored.

#

!includedir /etc/mysql/conf.d/

!includedir /etc/mysql/mysql.conf.d/

 最后发现,需要修改 的是  /etc/mysql/mysql.conf.d/mysqld.cnf

   使用sudovim /etc/mysql/mysql.conf.d/mysqld.cnf

   修改bind_address = 0.0.0.0 

   然后重启mysql服务即可: sudo /etc/init.d/mysql restart

ubuntu上mysql服务器安装后只能本地连接不能远程连接的问题的更多相关文章

  1. ubuntu系统安装mysql二进制压缩包(tar.gz)以及navicat远程连接服务器(linux系统)

    一.ubuntu安装mysql5.6二进制压缩包(tar.gz) 准备 0. 获取 mysql-5.5.15-linux2.6-i686.tar.gz 二进制安装文件 mysql 官网下载页面选择 L ...

  2. Ubuntu上mysql, 通过python连接报错Can't connect to MySQL server on xxx (10061)

    通过sqlyog连接ubuntu上的mysql报错 试了试python直接连接也报同样的错 那应该就是ubuntu上mysql服务自己的问题了 查看mysql 版本 mysql -V root@clo ...

  3. 设置root远程连接ubuntu上mysql

    1.安装mysql,如果是root用户,直接执行一下命令.如果非root,则需要用sudo命令 a. apt-get install mysql-server b. apt-get isntall m ...

  4. mysql 5.7.16安装与给远程连接权限

    ZIP Archive版是免安装的.只要解压就行了.不需要安装.我的放在d盘啦. 1.配置: 也就是my.ini文件的由来. 把my-default.ini(此文件是解压之后,自带的)这个文件复制一下 ...

  5. widows本地-xshell实现远程连接linux服务器图形界面

    本地环境远程连接linux图形界面,常用的实现工具有,VNC.Puty.Xshell等,这里我们用的xshell manager: Xmanager简介:Xmanager是一个运行于 Windows平 ...

  6. airtest本地连接和远程连接

    一.本地连接 # -*- coding: utf-8 -*-# from poco.drivers.android.uiautomation import AndroidUiautomationPoc ...

  7. MySQL的安装、改密及远程连接

    一.下载MySQL压缩包后的安装步骤 将压缩包解压到指定的目录 编辑好配置文件 [mysql] #设置MySQL客户端默认字符集 default-character-set=utf8 [mysqld] ...

  8. TimesTen学习(三)安装、连接、远程连接TimesTen数据库

    TimesTen学习(三)远程连接TimesTen数据库 <TimesTen学习(一)安装篇>:http://blog.itpub.net/23135684/viewspace-71774 ...

  9. linux中MySQL本地可以连接,远程连接不上问题

    1.网络或防火墙问题 (1)检查网络直接ping你的远程服务器,ping 182.61.22.107,可以ping通说明网络没问题 (2)看端口号3306是不是被防火墙挡住了,telnet 182.6 ...

随机推荐

  1. 命令行子shell 括号 ()

    子shell 控制变量 ansible-direc:~ # (export hello=world;echo $hello)worldansible-direc:~ # echo $hello ans ...

  2. H5页面实现一个Audio标签加载多个音频文件,并进行播放和展示音频长度

    最近微信项目中有需求,要将微信端发送过来的amr格式的语音文件,在项目中的页面上进行展示和播放,实现方式如下: 1.首先java后台收到微信端的消息推送的时候,使用 ffmpeg将amr格式的音频文件 ...

  3. cocos2dx 3.x(实现帧动画(人物动画,跑马灯效果)的几种方法)

    //创建一个跑酷的精灵
  auto sprite = Sprite::create("1.png");
 //设置精灵的坐标
 sprite->setPosition(Ve ...

  4. raspberry pi

    1. Expend System (sudo raspi-config) 2. Change keybaord layout to 104 key (US) 3. Change update sour ...

  5. nginx限制访问速度

    转自:http://siwei.me/blog/posts/nginx-ip 参考:http://tengine.taobao.org/document_cn/http_limit_req_cn.ht ...

  6. MVC HtmlHelper用法(一)@Html.BeginForm的使用总结

    1.@using(Html.BeginForm()){}                                                      //提交到当前页面 2.@using ...

  7. css巧妙实现分隔线

    单个标签实现分隔线 .demo_line_01{ padding: 0 20px 0; margin: 20px 0; line-height: 1px; border-left: 200px sol ...

  8. AJAX-----01远古时期的ajax

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. FIFO深度

    async fifo的full和empty的判断: 1)binary进制,MSB相同时,LSB也相同,empty: MSB不同时,LSB相同,full 2)gray code,MSB相同时,LSB也相 ...

  10. 13. 星际争霸之php设计模式--正面模式

    题记==============================================================================本php设计模式专辑来源于博客(jymo ...