mysql远程服务器访问数据库
创建一个MySQL用户,并设置可以远程访问
grant usage on *.* to 'fred'@'localhost' identified by 'fred';//创建用户fred密码ferd
select host,user,password from mysql.user where user='fred';//查看记录
grant all privileges on *.* to fred@'%'identified by 'fred';//设置可以远程访问
解决方法:
1、改表法:
可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从“localhost”改称“%”
|
x:\>mysql -u root -pvmware mysql> use mysql; mysql> flush privileges; |
注:mysql> flush privileges; 使修改生效。
2、授权法:
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
|
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; |
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
|
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword’ WITH GRANT OPTION; |
mysql远程服务器访问数据库的更多相关文章
- SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery)
SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery) 1.启用Ad Hoc Distributed Queries 在使用openrowset ...
- [linux] mysql跨服务器访问, iptables设置
跨服务器mysql访问, iptables配置 1> 设置被访问机器的mysql权限 grant all privileges on *.* to root@"[ip]" i ...
- [转]SQLServer跨服务器访问数据库(openrowset/opendatasource/openquery)
正 文: 1.启用Ad Hoc Distributed Queries 在使用openrowset/opendatasource前搜先要启用Ad Hoc Distributed Queries服务,因 ...
- 服务器访问数据库表mysql
服务器的MySQL配置就不说了,直接说一些用到的基础命令 登陆 show databases; use 数据库: show tables; 执行sql即可: 一定要有分号 select * from ...
- 开启mysql远程连接访问权限的几种方法
1.改表法. 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 " ...
- mysql远程连接/访问速度慢的解决方案
连接阿里云服务器上的数据库,速度很慢 账户密码正确 已关闭防火墙 修改 /etc/my.cnf,添加配置skip-name-resolve [mysqld] skip-name-resolve 在连接 ...
- mysql 远程 ip访问
默认情况下Linux内的mysql数据库mysql,user表内的用户权限只是对localhost即本机才能登陆.需要更改权限: 如下的方式确认: root#mysql -h localhost-u ...
- Mysql远程链接访问权限设置
Host 'XXX' is not allowed to connect to this MySQL server 解决方案/如何开启MySQL的远程帐号 如何开启MySQL的远程帐号-1)首先以 r ...
- 树莓派(rasperberry pi 2)上装mysql远程无法访问
于是组合关键字(树莓派 mysql)求百度问谷歌.未果.操刀自己来吧.检查mysql的配置文件 /etc/mysql/my.cnf 发现如下配置 # Instead of skip-networkin ...
随机推荐
- TensorFlow — 相关 API
TensorFlow — 相关 API TensorFlow 相关函数理解 任务时间:时间未知 tf.truncated_normal truncated_normal( shape, mean=0. ...
- BZOJ 4919 [Lydsy1706月赛]大根堆 (SRM08 T3)
[题解] 求一个序列的LIS有一个二分做法是这样的:f[i]表示长度为i的上升序列中最后一个数最小可以是多少,每次二分大于等于当前数字x的f[j],把f[j]修改为x:如果找不到这样的f[j],那就把 ...
- PAT 1131 Subway Map
In the big cities, the subway systems always look so complex to the visitors. To give you some sense ...
- [luoguP1103] 书本整理(DP)
传送门 以 去掉多少个 为阶段不好做. 去掉 k 个也可以变成选 n - k 个 f[i][j] 表示前 i 个数中 选 j 个的最优解,a[i] 必选 f[i][j] = min(f[i][j], ...
- 深刻理解Python中的元类(metaclass)--代码实践
根据http://blog.jobbole.com/21351/所作的代码实践. 这篇讲得不错,但以我现在的水平,用到的机会是很少的啦... #coding=utf-8 class ObjectCre ...
- 记一次 Hibernate 插入数据中文乱码报错解决
错误描述 程序运行,向表中插入数据(包含中文)报错:\xE6\xB2\x88\xE9\x9B\xAA... 但是自己另外新建一个数据库手动插入数据中文正常,同样修改数据库,表的编码之后同样不行.而且 ...
- 根据View找控制器
- (UIViewController*)viewController { for (UIView* next = [self superview]; next; next = next.superv ...
- strace oracle
http://www.itpub.net/thread-1865593-1-1.html
- @ResponseBody 返回json字符串的核心类是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter,它使用了Jackson 这个开源的第三方类库。主要是以下两个jar包:jackson-core-asl-1.6.4.jar;jackson-mapper-asl-1.6.4.jar
@ResponseBody 返回json字符串的核心类是org.springframework.http.converter.json.MappingJacksonHttpMessageConvert ...
- TreeView获取目录下的所有文件
/// <summary> /// TreeView获取目录下的所有文件 /// </summary> /// <param name="tree"& ...