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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
    • ¥15 钢筋实图交点识别,机器视觉代码
    • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
    • ¥50 400g qsfp 光模块iphy方案
    • ¥15 两块ADC0804用proteus仿真时,出现异常
    • ¥15 关于风控系统,如何去选择