douzhan8303 2019-08-07 08:11
浏览 288

从容器连接到远程数据库服务器时出错

I have a service deployed in mesos, which queries a remote database server. I used github.com/go-sql-driver/mysql to query the database from my Go code. It was working fine for about a week. But today I got this error: driver: bad connection

So I entered the docker container where my service runs and type in command line:

mysql -uxxx -hx.x.x.x -Pxxx -Dxxx -pxxx

Here's the response:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

This is the content of /etc/mysql/my.cnf file:

[mysql]
no-auto-rehash  # Faster start of mysql but no tab completition

What can be the error here? And how can I solve this?

Edit: When I run the same command from my local machine it works fine. I can query the database from the command line of my pc.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料