Leo*_*ard 2 mysql connection docker datagrip
我已经设法通过mysql命令行实用程序成功连接到运行MySQL的docker实例。但是,我正在努力通过JetBrains的DataGrip应用程序来做到这一点。
我的mysql cli命令如下:
mysql -h127.0.0.1 --port=8181 -uroot
Run Code Online (Sandbox Code Playgroud)
在DataGrip中生成的连接字符串为:
jdbc:mysql://127.0.0.1:8181
Run Code Online (Sandbox Code Playgroud)
我从DataGrip界面收到的错误是:
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Run Code Online (Sandbox Code Playgroud)
我缺少DataGrip中需要更改的任何内容。我已经读过,连接也必须通过TCP完成。不确定如何检查DataGrip是否正在执行此操作。
更新:我最终发现问题是我使用的docker容器。似乎DataGrip无法连接到版本8.0.1(mysql:8.0.1)mysql docker容器。我使用容器的5.7版进行了测试,可以成功连接。
我在使用DataGrip连接MySQL 8.0.3时遇到问题。您需要从Oracle 网站下载JDBC驱动程序。选择开发者版本(因为这是不稳定版本)。8.0.8版本对我有用。下载并保存在项目文件夹或计算机上类似的文件中。您稍后将需要它。
+然后选择Driver:Driver Files> Additional files单击,+然后选择jar您刚刚下载的文件Class下拉菜单中选择com.mysql.jdbc.DriverDialect为MySQLdefault和“ 模板为”jdbc:mysql://{host::localhost}?[:{port::3306}][/{database}?][\?<&,user={user},password={password},{:identifier}={:identifier}>]做完了!
使用新的驱动程序添加新的数据源。
如果发现以下错误:
[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
Run Code Online (Sandbox Code Playgroud)
您可以进行临时修复,以转到Advanced选项卡并设置serverTimezone变量UTC为例。
| 归档时间: |
|
| 查看次数: |
4054 次 |
| 最近记录: |