无法通过DataGrip应用程序连接到MySQL码头实例
我已成功地通过mysql命令行实用程序成功连接到运行MySQL的码头实例。但是,我正在努力通过JetBrains的DataGrip应用程序来做到这一点。无法通过DataGrip应用程序连接到MySQL码头实例
我的MySQL的CLI命令如下:
mysql -h127.0.0.1 --port=8181 -uroot
是在DataGrip生成的连接字符串是:
jdbc:mysql://127.0.0.1:8181
我从DataGrip接口得到的错误是:
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
有什么需要改变DataGrip,我失踪了。我已经读过,连接也必须通过TCP完成。不知道如何检查DataGrip是否这样做。
更新:我最终发现问题是我正在使用的码头容器。看来DataGrip无法连接到版本8.0.1(mysql:8.0.1)mysql docker容器。我使用容器的5.7版进行了测试,并且可以成功连接。
Leon,
我在将MySQL 8.0.3连接到DataGrip时遇到了问题。您需要从Oracle website下载JDBC驱动程序。选择开发人员发布(因为这是一个不稳定的版本)。 8.0.8版本适用于我。下载并保存在计算机上的项目文件夹或类似内容中。你以后会需要它。
- 转到DataGrip:文件>数据源。点击
+
并选择Driver
: - Screenshot of the Step above
- 上的
+
部分Driver Files
>Additional files
点击并选择jar
文件您刚刚下载 - 后,关于
Class
下拉列表中选择com.mysql.jdbc.Driver
- 马克
Dialect
为MySQL
- 在节URL模板上,将名称设为
default
和模板为jdbc:mysql://{host::localhost}?[:{port::3306}][/{database}?][\?<&,user={user},password={password},{:identifier}={:identifier}>]
- 点击申请
完成!
Screenshot of MySQL 8.0.3 running on Datagrip
使用新的驱动程序添加一个新的数据源。
如果您发现以下错误:
[01S00] The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support
你可以做一个临时的解决办法要去Advanced
标签,作为一个例子设置serverTimezone
变量UTC
。
感谢您的详细发布! –
请将连接窗口的截图发送到maxim.sobolevskiy [at] jetbrains.com,我会帮你的。 – moscas
谢谢Jetbrains团队。您试图帮助我发送几封电子邮件。 –
不客气!感谢您的报道,Leon! – moscas