2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 数据库连接工具-DataGrip 使用总结

数据库连接工具-DataGrip 使用总结

时间:2019-11-21 15:26:25

相关推荐

数据库连接工具-DataGrip 使用总结

文章目录

一、DataGrip 连接postgresql二、DataGrip 连接mysql三、datagrip工作常用技巧或功能总结1. 常用快捷键2. DataGrip 导出与导入数据(只导出表结构)3. 生成创建某张表的脚本四、参考

一、DataGrip 连接postgresql

1) 开启postgresql对外端口监听

默认情况下postgresql 监听没有对外开放。

开始pg监听脚本,修改,脚本中的postgresql 的data目录:

#!/bin/bash# # open postgresq setting shell#function prc_pg_hba_conf(){echo "process pg_hba.conf"pg_hba_conf=$default_pg_data_path"pg_hba.conf"echo "pg_hba.conf: " $pg_hba_conf#host all all 0.0.0.0/0 trust# 在最后一行行后添加字符串sed -i '$ahost all all 0.0.0.0/0trust' $pg_hba_conf}function prc_postgresql_conf(){echo "process postgresql.conf"pg_conf=$default_pg_data_path"postgresql.conf"echo "postgresql.conf: " $pg_conf#listen_addresses = '*'sed -i "s/#listen_addresses =.*/listen_addresses = '*'"/ $pg_conf}function usage(){echo -e "Usage"echo -e "\topenpg.sh [-p]"echo -e "Options"echo -e "\t-p\t set postgresql data dir"}function main(){local param1=$1local default_pg_data_path="/url/local/postgreql/data/"if [ $# -gt 1 ]; thenusageexit 1fiif [ $# -eq 1 ]; thenif [ "$param1"x != "-r"x ]; thenusageexit 1elsedefault_pg_data_path=$param1fifiecho "pg_data_path: " $default_pg_data_pathprc_pg_hba_confprc_postgresql_conf}main $*

DataGrip 配置连接postgresql

二、DataGrip 连接mysql

DataGrip .1 连接mysql 8.0.16

参考URL: /linkenpark/p/10908101.html

mysql时区错误及解决办法

参考URL: /p/0d53218da27d

有两点需要注意:

默认下载mysql驱动比较慢,可以采用参考博文方式,自行下载,指定加载驱动。

/downloads/connector/j/

选择Platform Independent,下载依赖mysql java驱动。

MySQL Connect/J 8.0 mysql时区问题

经过测试,在mysql服务器端配置文件指定时区,url就可以不带时区参数。

在MySQL的配置文件my.ini中加入

default-time_zone = '+8:00'

三、datagrip工作常用技巧或功能总结

1. 常用快捷键

Ctrl+Enter:执行选中的SQL语句Ctrl+N / 双击Shift :全局搜索,点击可直接进入表Ctrl + Alt + L : sql格式化

2. DataGrip 导出与导入数据(只导出表结构)

导出数据

DataGrip有多种数据导出模式,常用的有两种:

Dump Data to File

Dump Data to File模式,该模式是导出各种单个文件,比如,SQL,HTML,TSV,CSV等文件,当然这是我们在对某个表进行操作的时候使用的。

Dump with ‘mysqldump’

Dump with 'mysqldump’模式,该模式是使用MySql的mysqldump组件进行数据导出,该方法导出的SQL文件,可以选择,是否包含数据或者是只导出数据结构。该模式是我们常用的数据库导出。

只导出结构

导出结构与上面基本一致,只是在下面命令行的表名前面,添加一个-d记住,后面要添加一个空格,如下图

手动添加一个 -d 选项,可以只导出表结构。

导入数据

3. 生成创建某张表的脚本

假如我们在Dev环境创建了一张表,提测到QA环境时,测试要求提供脚本,但是你又没有保存,此时可以使用SQL Generator自动生成创建表的脚本:

四、参考

数据库管理工具DataGrip使用总结(一)

参考URL: /zwwhnly/p/10585987.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。