一、下载安装DBeaver
https://dbeaver.io/download/
win7安装24版,安装成功但是无法打开,安装23.3.5版无此问题
1.1 历史版本下载
Archive Files | DBeaver Community
二、连接本机mysql服务器
选择【mysql】-【下一步】
【mysql地址】+【用户名】+【密码】-【完成】
首次连接需要下载驱动
【下载驱动】
2.1 DBeaver打开mysql
三、SQL
3.1 打开SQL操作界面
3.2 常用SQL命令
3.2.1 关键词1
mysql
一个开源的关系型数据库管理系统,支持跨平台
information_schema
mysql除自己安装的数据库外,还有一个information_schema数据库,其是mysql自带的,提供访问数据库元数据的方式。元数据是数据的数据,如数据库名、表名、列的数据类型或访问权限等等。information_schema是信息数据库,保存着mysql服务器所维护的所有其他数据库的信息,在information_schema中有数个只读表,它实际上是视图而不是基本表。访问该数据中所含表的唯一方式是select,其不支持insert、update、delete。
3.2.2 关键词2
table_schema 数据库名
table_name 表名
column_name 字段名
select xxx1 from xxx2 where xxx3 查询语句
3.2.3 常用语句
查询所有数据库
show databases;
查询指定数据库中的所有表名
select table_name from information_schema.tables where table_schema='数据库名称';
select table_name from information_schema.tables where table_schema='osgiweb';
查询指定数据库中所有字段名
select column_name from information_schema.columns where table_schema='数据库名称'
select column_name from information_schema.columns where table_schema='osgiweb'
查询指定表中所有字段名
select column_name from information_schema.columns where table_name='表名'
select column_name from information_schema.columns where table_name='periodic_report'
查询指定表中所有字段名和字段类型
select column_name,data_type from information_schema.columns where table_name='表名';
select column_name,data_type from information_schema.columns where table_name='periodic_report';