快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

mysql从库怎么访问,mysql怎么访问oracle数据库

怎么访问别人的mysql数据库

找到MySQL配置文件,搜索“bind-address”,找到这一行:

创新互联公司专注于企业成都全网营销、网站重做改版、海北州网站定制设计、自适应品牌网站建设、H5高端网站建设电子商务商城网站建设、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为海北州等各大城市提供网站开发制作服务。

bind-address = 127.0.0.1 在前面加一个#,注释掉这一行,保存,重启MySQL。再通过远程访问就可以了,telnet可以发现端口也打开了。

例我们配置

1. 确保skip-networking被删除或者屏蔽,否则不支持TCP/IP 访问2. 增加行bind-address = 65.55.55.2,替代65.55.55.2 为你的服务器地址

修改后,配置为:

[mysqld]user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplanguage = /usr/share/mysql/Englishbind-address = 65.55.55.2# skip-networking保存并关闭配置文件重启mysql服务器:# /etc/init.d/mysql restart

如果上面办法没有用我们可以通用mysql命令模式进行设置

1。 改表法。

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

CODE:mysql -u root -p123mysqluse mysql;mysqlupdate user set host = '%' where user = 'root';mysqlselect host, user from user;

如何通过ip访问MySql数据库

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

"mysql"

数据库中

"user"

表里的

"host"

字段,把"localhost"改称"%",即可。

mysql

-u

root

-pvmwaremysqluse

mysql;mysqlupdate

user

set

host

=

'%'

where

user

=

'root';mysqlselect

host,

user

from

user;

2.授权法。例如,你想用户myuser使用密码mypassword通过ip地址连接到mysql服务器,使用:

GRANT

ALL

PRIVILEGES

ON

*.*

TO

'myuser'@'%'

IDENTIFIED

BY

'mypassword'

WITH

GRANT

OPTION;

如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码

GRANT

ALL

PRIVILEGES

ON

*.*

TO

'myuser'@'192.168.1.3'

IDENTIFIED

BY

'mypassword'

WITH

GRANT

OPTION;

如何让mysql数据库允许被远程连接访问?

第一:更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称'%'。 \x0d\x0a或者新加条记录,“host” 项为要访问的ip地址,并授权。重启mysql服务。 \x0d\x0a第二:在系统防火墙添加例外端口:3306,并允许例外。 \x0d\x0a\x0d\x0a错误提示: \x0d\x0aERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server \x0d\x0a的解决方法: \x0d\x0a1。改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%" \x0d\x0a1.mysql -u root -pvmware\x0d\x0amysqluse mysql;\x0d\x0amysqlupdate user set host = '%' where user = 'root';\x0d\x0amysqlselect host, user from user; \x0d\x0a\x0d\x0a2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。 \x0d\x0a\x0d\x0aGRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; \x0d\x0a如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码 \x0d\x0aGRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; \x0d\x0a\x0d\x0a3.在window自带的防火墙里的例外添加3306端口 \x0d\x0a\x0d\x0a总结: \x0d\x0amysql -u root -p \x0d\x0amysqluse mysql; \x0d\x0amysqlselect 'host' from user where user='root'; \x0d\x0amysqlupdate user set host = '%' where user ='root'; \x0d\x0amysqlflush privileges; \x0d\x0amysqlselect 'host' from user where user='root'; \x0d\x0a第一句是以权限用户root登录 \x0d\x0a第二句:选择mysql库 \x0d\x0a第三句:查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称) \x0d\x0a第四句:修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址 \x0d\x0a第五句:刷新MySQL的系统权限相关表 \x0d\x0a第六句:再重新查看user表时,有修改。。 \x0d\x0a重起mysql服务即可完成。

如何实现mysql不同数据库之间的数据访问

1.主上修改my.cnf文件:

server-id=1

log-bin=mysql-bin

2.从上修改配置文件 my.cnf

server-id=2

relay-log=relay-bin

read-only =1

replicate-ignore-db = mysql

replicate-ignore-db = test

replicate-ignore-db = information_schema

#replicate-wild-do-table = tt.admin

replicate-wild-do-table = my_db.stu // 所要同步的数据库的单个表

3. 创建 同步的用户(主上)

grant replication client,replication slave on *.* to rep@'10.41.50.105' identified by 'root';

4.同步到主库(在从上操作)

change master to master_host='10.41.50.80',master_user='rep',master_password='root';

5.在从上验证:

show slave status\G;

主从同步某些表

MySQL数据库怎么实现远程连接访问

或者新加条记录,“host” 项为要访问的ip地址,并授权。重启mysql服务。

第二:在系统防火墙添加例外端口:3306,并允许例外。

错误提示:

ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server

的解决方法:

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

1.mysql -u root -pvmware

mysqluse mysql;

mysqlupdate user set host = '%' where user = 'root';

mysqlselect host, user from user;

2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

3.在window自带的防火墙里的例外添加3306端口

总结:

mysql -u root -p

mysqluse mysql;

mysqlselect 'host' from user where user='root';

mysqlupdate user set host = '%' where user ='root';

mysqlflush privileges;

mysqlselect 'host' from user where user='root';

第一句是以权限用户root登录

第二句:选择mysql库

第三句:查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)

第四句:修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址

第五句:刷新MySQL的系统权限相关表

第六句:再重新查看user表时,有修改。。

如何远程访问MySQL数据库详解

1、d:\MySQL\bin\MySQL -h localhost -u root 

这样应该可以进入MySQL服务器 

代码如下:

MySQLupdate user set host = '%' where user = 'root'; 

MySQLselect host, user from user;

MySQLupdate user set host = '%' where user = 'root'; 

MySQLselect host, user from user; 

2、MySQLGRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION 

予任何主机访问数据的权限 

3、MySQLFLUSH PRIVILEGES 

修改生效 

4、MySQLEXIT 

退出MySQL服务器 

这样就可以在其它任何的主机上以root身份登录啦!


网站名称:mysql从库怎么访问,mysql怎么访问oracle数据库
分享链接:http://6mz.cn/article/dsecopo.html

其他资讯