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

    报告相同问题?

    悬赏问题

    • ¥50 树莓派安卓APK系统签名
    • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗