Home  >  Article  >  Database  >  Windows下mysql客户端访问Linux下mysql-cluster的SQL节点服务器_MySQL

Windows下mysql客户端访问Linux下mysql-cluster的SQL节点服务器_MySQL

WBOY
WBOYOriginal
2016-06-01 13:38:381059browse

bitsCN.com


Windows下mysql客户端访问Linux下mysql-cluster的SQL节点服务器

 

在Windows下面,如果大家都安装了WAMP包,那么mysql服务器也安装了,同时mysql客户端也安装了,并不把客户端和服务器分开来安装。如果我们要通过Windows下的客户端来访问Linux下集群环境中的SQL节点服务器,需要注意些什么呢?

    集群环境部署:

 

    55.133             mgm node  CentOS5

 

    55.10  data node + sql node  CentOS5

 

    55.9   data node + sql node  CentOS5

 

    Linux下的mysql配置文件为:my.cnf。在 my.cnf 中,有下面这样段话:

 

    All interaction with mysqld must be made via Unix sockets or named pipes. Note that using this option without enabling named pipes on Windows (via the "enable-named-pipe" option) will render mysqld useless!

 

    这句话的意思:我们需要在客户端的 [mysqld] 的下面加上参数:enable-named-pipe,但是加上这个参数以后是不是意味着服务器端的配置文件也需要修改:

 

    测试方案:

 

    1. 假设 windows 客户端 55.134 通过 named pipes 连接 SQL 节点 55.10 

 

    修改 133 上 my.ini 文件:[mysqld] enable-named-pipe

 

    修改 10 上 my.cnf 文件:删除掉:[client] 模块

 

    2. 假设 Linux 客户端 55.135 通过网络连接 SQL 节点 55.9 

 

    修改 10 上 my.cnf 文件:

 

    [client] 

 

    port = 3306 

 

    socket = /var/lib/mysql/mysql.sock

   

    1. 为了使SQL节点可以让其它MySQL客户端通过TCP/IP连接方式来远程连接SQL节点,已经注释掉:# skip-networking,使其它主机通过网络可以访问。

 

    2. 也已经通过mysql授权:GRANT ALL ON *.* TO mysql IDENTIFIED BY ' *** '; 通过查看mysql.user,里面已经显示:

 

    Host | User  | Password

 

    %     mysql    *3810D9104CD9CDC2EDD5C87D48D4D778018656C6 

 

    测试:在 55.133 上通过命令:mysql -h root@***.***.55.10 -u mysql -p 可以成功登录 55.10 上的数据库。

 

    3. 根据Web服务器部署方式,已经修改过 55.10 和 55.9 上的 DNS 解析配置文件 /etc/resolv.conf 中的解析路径和IP。

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn