您的位置:首页 > 数据库 > SQL

2012-12-07 19:03 amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away

2012-12-07 19:08 561 查看
amoeba 的安装和配置参考http://docs.hexnova.com/amoeba/index.html

安装和配置的过程比较简单,在此记录一个使用过程中遇到的问题:
[mysql@db01 ]$ mysql [b]-h127.0.0.1-uroot -pmysql -P8066

[/b]
Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 969886252

Server version: 5.1.45-mysql-amoeba-proxy-2.2.0

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

mysql> show databases;

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect...

Connection id: 969886252

Current database: *** NONE ***

ERROR 2013 (HY000): Lost connection to MySQL server during query

查看amoeba日志/usr/local/amoeba/logs/net.log中的错误:

2012-12-07 18:25:36,900 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=1076825585

2012-12-07 18:25:36,929 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!

2012-12-07 18:25:36,934 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=1002500837

2012-12-07 18:25:39,905 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!

2012-12-07 18:25:39,908 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=282106579

2012-12-07 18:25:39,938 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!

2012-12-07 18:25:39,943 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=127368091

仔细检查dbServers.xml配置后发现factoryConfig中

<property name="password">password</property>

默认是被注释掉的,[b]注释取消后正常。


看来这是作者搞的一个乌龙呀,可害苦了我,耽误了好大一会功夫。[/b]
修改内容见下:
<factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">

<property name="manager">${defaultManager}</property>

<property name="sendBufferSize">64</property>

<property name="receiveBufferSize">128</property>
<!-- mysql port -->

<property name="port">3306</property>
<!-- mysql schema -->

<property name="schema">test</property>
<!-- mysql user -->

<property name="user">root</property>
<!-- mysql password

<property name="password">password</property>

-->

</factoryConfig> 本文出自 “简单就是美的博客” 博客,请务必保留此出处http://simpledevops.blog.51cto.com/3091246/1082001
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: