安装好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. iOS,html使用交互相关

    1.UIWebView加载Html文件 2.UIWebView的委托方法 3.UIWebView和JS交互 4.使用Safari,WebView调试html 5.使用WKWebView加载Html,和 ...

  2. LUA OOP编程实现方法

    lua原生不支持OOP特性 确实如此, 同时可以采用其它lua代码的方式实现OOP的特性. OOP四大特性 抽象 封装 继承 多态 http://www.cnblogs.com/xiaosongluf ...

  3. mvc ajax dropdownlist onchang事件响应

    <script type="text/javascript"> $("#Cycle").on("change", functio ...

  4. Eclipse in Ubuntu16.04LTS Final Beta

    #2016.03.30 在虚拟机Ubuntu16.04LTS上,用Eclipse编写运行Java,就目前而言,实在不是明智之举.卡顿极其厉害,还是在物理机上运行吧.那么继续Ubuntu的探索历程. 用 ...

  5. 【转】赞一下huicpc035

    以下转自:http://hi.baidu.com/fpkelejggfbfimd/item/99421eaefa93a814a9cfb722 本来以为HNU的huicpc035和我一样退役了,后来听说 ...

  6. 原生js快速渲染dom节点

    function renderDom(str){ var _div = document.createElement('div'); _div.innerHTML = str; var dom_tem ...

  7. Repeater控件三层嵌套-内层Repeater添加绑定事件

    用Repeater三层嵌套,最外层Repeater可以生成自己的ItemCommand事件.但接下来中间层因为是嵌套了的,所以无法在属性窗口中生成自己的事件.如果手动敲入则无效. 解决办法是需要通过编 ...

  8. atomic vs. nonatomic

    Declaring a property atomic makes compiler generate additional code that prevents concurrent access ...

  9. 《Vuser虚拟用户开发》读书笔记

    学会了Vuser开发只是算了性能测试入了门.要做好性能测试还需要了解系统的功能,架构和设计测试用例. 脚本选用什么协议的依据是需要模拟的客户端与服务器之间的通信采用什么协议.与具体的开发技术并无直接的 ...

  10. 如何利用.snk文件生成DLL文件中的Publickeytoken

    1.在该路径下C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin查找是否有sn.exe. 没有的话,从网上下载,注意需要的版本. 2.打开c ...