腾讯云服务器上部署jira,连接mysql数据库报错Communications link failure The last packet successfully received from the server was 2 milliseconds ago. The last packet sent successfully to the server was 1 milliseconds ago.

用用navicat 连接部署的mysql 数据库就没问题,奇怪了。也自查服务器的安全组设置没问题。

尝试在my.cnf 配置文件中 设置 wait_timeout = 31536000
interactive_timeout = 31536000 ,还是同样的报错。裂开

docker run --name atlassian-mysql --restart always -p 3306:3306 -v /opt/mysql_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

连接数据库

docker run -it --link atlassian-mysql:mysql --rm mysql:5.7 sh -c ‘exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"’

创建数据库

create database jira default character set utf8 collate utf8_bin;

创建用户

create user jira@% identified by ‘jira’;
grant all on . to jira@% with grant option;
flush privileges;

添加用户

alter user ‘jira’@‘%’ identified with mysql_native_password by ‘jira’;

修改mysql事物隔离级别

set global transaction isolation level read committed;
set session transaction isolation level read committed;

#启动jira实例
docker pull atlassian/jira-software:8.14.0-jdk8
docker run -d -p 8080:8080 --name jira --restart always --privileged=true -u root atlassian/jira-software:8.14.0-jdk8

Connecting Jira applications to MySQL 5.7 | Administering Jira applications Data Center and Server 8.14 | Atlassian Documentation 重要的配置指导
关键说明:
1.数据库是5.7 版本,驱动是5.1.49 ;
2.mysql驱动放在jira容器的/opt/atlassian/jira/lib/目录; https://downloads.mysql.com/archives/c-j/
3.mysql 的配置文件在/etc/mysql/mysql.conf目录下的mysqld.cnf ,需要按照配置指导中增加相关的配置项;
4.进行mysql 容器docker exec -it atlassian-mysql /bin/bash,执行vim 命令无法执行,需要用到 apt-get update 、apt-get install -y vim 命令;
5.配置信息有变更需要重启对应的容器才可生效;