默认情况下Linux内的mysql数据库mysql,user表内的用户权限只是对localhost即本机才能登陆。需要更改权限:

如下的方式确认:

root#mysql -h localhost-u mysql -p 
Enter password:    ******

Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 4 to server version: 4.0.20a-debug

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> use mysql;   (此DB存放MySQL的各种配置信息)
Database changed
mysql> select host,user from user; (查看用户的权限情况)
+-------------+-------+
| host            | user    |
+-------------+-------+
| localhost      |           |
| localhost      | root   |
| localhost      |           |
| localhost      | mysql |
+-------------+-------+
6 rows in set (0.02 sec)

由此可以看出,只能以localhost的主机方式访问。

解决方法:

mysql> Grant all privileges on *.* to 'root'@'%' identified by ‘password’with grant option;
(%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名;‘root’则是指要使用的用户名,)

mysql> flush privileges;  (运行为句才生效,或者重启MySQL)
Query OK, 0 rows affected (0.03 sec)

mysql> select host,user from user; (再次查看用户的权限情况)
+-------------+-------+
| host            | user    |
+-------------+-------+

| %                 | mysql |

| %                 | root   |
| localhost      |           |
| localhost      | root   |
| localhost      |           |
| localhost      | mysql |
+-------------+-------+

mysql>exit

现在再试试:
root#mysql -h mysql -u root -p
Enter password:******
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 9 to server version: 4.0.20a-debug

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql>

就成功连接上了。

mysql 远程 ip访问的更多相关文章

  1. 脚本_统计每个远程IP访问本机apache的次数

    #!bin/bash#功能:统计每个远程IP访问本机apache的次数#作者:liusingbonawk '{ip[$1]++} END{for(i in ip){print ip[i],i}}'  ...

  2. mysql允许远程IP访问

    默认情况下Linux内的mysql数据库mysql,user表内的用户权限只是对localhost即本机才能登陆.需要更改权限: mysql> Grant all privileges on * ...

  3. Linux下支持mysql支持远程ip访问

    示例代码: use mysql; SELECT `Host`,`User` FROM user; UPDATE user SET `Host` = '%' WHERE `User` = 'use**' ...

  4. 开启mysql远程连接访问权限的几种方法

    1.改表法. 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 " ...

  5. MySQL远程(IP)连接报错:Host 'IP地址' is not allowed to connect to this MySQL server

    ERROR 1130: Host ’192.168.1.3′ is not allowed to connect to this MySQL server这是告诉你没有权限连接指定IP的主机,下面我们 ...

  6. RabbitMQ 远程 IP 访问 解决办法 -摘自网络

    刚刚安装的RabbitMQ-Server-3.3.5,并且也已经开启了Web管理功能,但是现在存在一个问题: 出于安全的考虑,guest这个默认的用户只能通过http://localhost:1567 ...

  7. RabbitMQ---5、远程 IP 访问

    刚刚安装的RabbitMQ-Server-3.3.7,并且也已经开启了Web管理功能,但是现在存在一个问题: 出于安全的考虑,guest这个默认的用户只能通过http://localhost:1567 ...

  8. Mysql远程链接访问权限设置

    Host 'XXX' is not allowed to connect to this MySQL server 解决方案/如何开启MySQL的远程帐号 如何开启MySQL的远程帐号-1)首先以 r ...

  9. mysql远程服务器访问数据库

    创建一个MySQL用户,并设置可以远程访问 grant usage on *.* to 'fred'@'localhost' identified by 'fred';//创建用户fred密码ferd ...

随机推荐

  1. insert into table 插入多条数据

    方法1: insert into `ttt` select '001','语文' union all select '002','数学' union all select '003','英语'; 方法 ...

  2. tips:Java中的switch的选择因子

    tips:Java中的switch的选择因子! /*  switch(){   }  */ switch的()中的判断条件能是什么类型呢? 事实上,在我们学习c++的了解中,switch的参数是一个能 ...

  3. selenium在scrapy中的应用

    引入 在通过scrapy框架进行某些网站数据爬取的时候,往往会碰到页面动态数据加载的情况发生,如果直接使用scrapy对其url发请求,是绝对获取不到那部分动态加载出来的数据值.但是通过观察我们会发现 ...

  4. sourcetree回退已推送的代码

    方法一: https://blog.csdn.net/gang544043963/article/details/71511958 我百度到博主用这种界面的方式进行的,可视化很好.我想应该可以很好的回 ...

  5. 用bayes公式进行机器学习的经典案例

    用bayes公式进行机器学习的经典案例 从本科时候(大约9年前)刚接触Bayes公式,只知道P(A|B)×P(B) = P(AB) = P(B|A)×P(A) 到硕士期间,机器学习课上对P(B|A)P ...

  6. Ruby学习笔记6: 动态web app的建立(3)--多Model之间的交互

    We first built a static site which displayed a static image using only a Controller and a View. This ...

  7. 34.scrapy解决爬虫翻页问题

    这里主要解决的问题: 1.翻页需要找到页面中加载的两个参数. '__VIEWSTATE': '{}'.format(response.meta['data']['__VIEWSTATE']), '__ ...

  8. 17.docker及scrapy-splash安装-1

    docker 安装网址: https://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/ 这就安装成功了!!!

  9. 12.利用kakatips对网站数据信息监控

    网站信息监控 kakatips软件 百度云链接:https://pan.baidu.com/s/1lNH8OGODbIvYeFTjz6kVEQ 密码:5qtz 这是我编辑好的具体详情如下: 有效标记需 ...

  10. 学习笔记:CommonJS规范、AMD规范

    CommonJS规范 http://wiki.jikexueyuan.com/project/webpack-handbook/commonjs.html CommonJS 规范 http://www ...