使用 HeidiSQL 的基本帮助

This document aims to give users some basic help to get started with HeidiSQL. Over the years, the feature list has grown longer and longer. So, especially new users sometimes don't know where to look at for particular things. In such cases, you can watch out here for a first help. If you don't find what you're looking for, please register in the forum and post a question.

本文档旨在为用户提供一些基本的帮助,帮助他们开始使用 HeidiSQL。随着时间的推移,功能列表变得越来越长。因此,特别是新用户有时不知道在哪里寻找特定的东西。在这种情况下,你可以在这里寻求帮助。如果你没有找到你要找的东西,请在论坛注册并发布问题。

Requirements

要求

HeidiSQL runs fine on Windows 8 and 10 (and on Windows 7 with some minor issues). Running HeidiSQL on Wine is currently quite unstable.

在 Windows 8和10上运行良好(在 Windows 7上也有一些小问题)。在 Wine 上运行 HeidiSQL 目前相当不稳定。

Connecting to a server

连接到服务器

Basics

基本知识

HeidiSQL is a so called client application, only usable when you have some server available. So, make sure you have some MariaDB, MySQL, MS SQL, PostgreSQL server or SQLite database file to connect to.

HeidiSQL 是一个所谓的客户端应用程序,只有当你有一些服务器可用时才能使用。所以,确保你有一些 MariaDB,MySQL,MS SQL,PostgreSQL 服务器或 SQLite 数据库文件可以连接。

connection

A simple setup is to have a MariaDB server installed on localhost (equivalent to the special IP address 127.0.0.1). In HeidiSQL's session manager, you click on the "New" button to create a new connection, and most default settings are already set for you, except from the password, which is mostly not an empty one on a newly installed MariaDB server:

一个简单的设置是在本地主机上安装一个 MariaDB 服务器(相当于特殊的 IP 地址127.0.0.1)。在 HeidiSQL 的会话管理器中,你点击“ New”按钮来创建一个新的连接,大多数默认设置已经为你设置好了,除了密码,在新安装的 MariaDB 服务器上,密码通常不是空的:

You can organize your stored sessions in folders. To create a folder, click the dropdown arrow on the "New" button, then click "Folder in root folder" or "Folder in selected folder". Once you have a folder, you can create connections in it, or drag existing connections into that folder.

您可以在文件夹中组织存储的会话。要创建文件夹,请单击“新建”按钮上的下拉箭头,然后单击“根文件夹中的文件夹”或“选定文件夹中的文件夹”。一旦有了文件夹,就可以在其中创建连接,或者将现有连接拖放到该文件夹中。

Setting up a SSH tunnel connection to MariaDB/MySQL/PostgreSQL

设置到 MariaDB/MySQL/PostgreSQL 的 SSH 隧道连接

If your MariaDB/MySQL/PostgreSQL server is located on a remote machine which is only accessible via SSH, then you still can use HeidiSQL to connect to it. You just need the additional plink.exe from the PuTTY project, place it somewhere on your harddisk, and finally tell HeidiSQL where it is and the SSH credentials plus the MariaDB/MySQL/PostgreSQL credentials.

如果您的 MariaDB/MySQL/PostgreSQL 服务器位于只能通过 SSH 访问的远程机器上,那么您仍然可以使用 HeidiSQL 连接到它。您只需要 PuTTY 项目中附加的 plink.exe,将其放在硬盘的某个位置,最后告诉 HeidiSQL 它在哪里,以及 SSH 凭据和 MariaDB/MySQL/PostgreSQL 凭据。

Note that the default host name for the SSH server is the one you entered in the "Settings" tab. HeidiSQL then advices plink.exe to connect to that host name, or, when you entered a SSH host name, that one is taken. Additionally, the host name on the "Settings" tab is always taken for the -L (listen) option in plink.exe.

请注意,SSH 服务器的默认主机名是您在“ Settings”选项卡中输入的主机名。然后通知 plink.exe 连接到该主机名,或者,当您输入 SSH 主机名时,该主机名已被使用。此外,plink.exe 中的 -l (listen)选项始终使用“ Settings”选项卡上的主机名。

ssh tunnel

Example settings:

示例设置:

  • "Settings" tab: “设置”选项卡:
    • Hostname: "127.0.0.1" 主机名: “127.0.0.1”
    • Password: [your mysql password] Password: [您的 mysql 密码]
    • Port: "3306" in most cases 端口: 大多数情况下是“3306”
  • "SSH tunnel tab: “ SSH 隧道标签:
    • SSH Host: [your server name] SSH 主机: [你的服务器名]
    • Port: "22" in most cases 端口: 大多数情况下是“22”
    • Username: [your ssh user] 用户名: [您的 ssh 用户]
    • Password: [your ssh password] Password: [ your ssh Password ]
    • Local port: "3307" 当地港口: “3307”

The following error, or a similar one, is mostly caused by a tunnel onto the official IP address of your remote server:

下面的错误,或者类似的错误,主要是通过一个隧道到您的远程服务器的官方 IP 地址所造成的:

Lost connection to MySQL server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"
在“读取初始通信包”时与 MySQL 服务器断开连接,系统错误: 0“内部错误/检查(非系统错误)”
In such cases, ensure you're using "127.0.0.1" in 在这种情况下,请确保您使用“127.0.0.1”Settings > Hostname/IP 设置 > 主机名/IP, and the remote IP of your server in ,以及您的服务器的远程 IP 地址SSH tunnel > Host.

 

Command line switches

命令行开关

Although HeidiSQL is a pure GUI application, it can be automated for connecting and opening files via command line parameters. Parameter names are case sensitive and are based on those used by the MariaDB/MySQL command line applications, e.g. mysqldump.

尽管 HeidiSQL 是一个纯 GUI 应用程序,但它可以通过命令行参数自动连接和打开文件。参数名称区分大小写,基于 MariaDB/MySQL 命令行应用程序使用的名称,例如 mysqldump。

Common pitfalls:

常见陷阱:

  • Be sure to call HeidiSQL with its full file name ("heidisql.exe"), not with the short version ("heidisql"). HeidiSQL's command line parser expects that this way. This should be fixed in the future.
  • 一定要使用它的完整文件名(“ HeidiSQL.exe”)调用 HeidiSQL,而不是使用短版本(“ HeidiSQL”)。HeidiSQL 的命令行解析器期望这样做。这个问题应该在将来得到解决。
  • Parameter keys can be separated with = or one space from their value, e.g. -h=localhost
  • 参数键可以用 = 或一个空格来分隔,例如-h = localhost
  • Parameters containing a dot must be wrapped in double quotes. This is important when passing an IP address: -h=192.168.1.1 will use only the first segment 192, while -h="192.168.1.1" is the correct form.
  • 包含点的参数必须用双引号包装。这在传递 IP 地址时很重要:-h = 192.168.1.1将只使用第一个段192,而-h = “192.168.1.1”是正确的格式。
Short switch 短路开关 Long switch 长开关 Description 描述 Default value 默认值
-d - d --description -- 描述 Session name 会议名称  
-n - n --nettype -- nettype Network protocol type: 网络协议类型:
  • 0 = MariaDB/MySQL (TCP/IP)
  • 1 = MariaDB/MySQL (named pipe) 1 = MariaDB/MySQL (命名管道)
  • 2 = MariaDB/MySQL (SSH tunnel) 2 = MariaDB/MySQL (SSH 隧道)
  • 3 = MSSQL (named pipe) 3 = MSSQL (命名管道)
  • 4 = MSSQL (TCP/IP)
  • 5 = MSSQL (SPX/IPX)
  • 6 = MSSQL (Banyan VINES)
  • 7 = MSSQL (Windows RPC) 7 = MSSQL (windowsrpc)
  • 8 = PostgreSQL (TCP/IP)
  • 9 = PostgreSQL (SSH tunnel) 9 = PostgreSQL (SSH 隧道)
  • 10 = SQLite
  • 11 = ProxySQL Admin
0
-h - 嗨-嗨 --host -- 主人 Host name 主机名  
-l - l --library -- 图书馆 Library or provider (added in v11.1): 库或提供程序(在 v11.1中添加) :
  • MySQL/MariaDB: 返回文章页面 MySQL/MariaDB:
    • libmariadb.dll
    • libmysql.dll 3. libmysql.dll
    • libmysql-6.1.dll Libmysql-6.1. dll
    • ... any fitting dll from your HeidiSQL directory
    • 从你的 HeidiSQL 目录中找到任何合适的 dll
  • MS SQL: 微软 SQL:
    • MSOLEDBSQL
    • SQLOLEDB
  • PostgreSQL: 返回文章页面博客:
    • libpq.dll 2. libpq.dll
    • libpq-12.dll Libpq-12. dll
    • ... any fitting dll from your HeidiSQL directory
    • 从你的 HeidiSQL 目录中找到任何合适的 dll
  • SQLite:
    • sqlite3.dll 3. dll
    • ... any fitting dll from your HeidiSQL directory
    • 从你的 HeidiSQL 目录中找到任何合适的 dll
Depends on the given network protocol, see underlined values取决于给定的网络协议,请参见带下划线的值
-u - u --user -- 用户 User name 用户名  
-p - p --password -- 密码 Password 密码  
-P - p --port “ port”的变体 Port 港口 3306
-S - s --socket 插座 Socket name, for connecting via named pipe套接字名称,用于通过命名管道连接  
-db - 分贝 --databases -- 数据库 Databases, separated by semicolon. Single database on PostgreSQL.数据库,以分号分隔。 PostgreSQL 上的单个数据库。  
-W - w --winauth -- winauth Use Windows authentication: 1 or 0. (MSSQL only, added in v9.4).使用 Windows 身份验证: 1或0. (仅限于 MSSQL,在 v9.4中添加)。 0
-cte - 慢性创伤性脑炎 --cleartextenabled -- 完好无损 Enable cleartext authentication: 1 or 0. (MySQL and MariaDB only)启用 cleartext 身份验证: 1或0. (仅支持 MySQL 和 MariaDB) 0
  --ssl -- ssl Use SSL. (1=yes, 0=no)使用 SSL。(1 = yes,0 = no) 0
-sslpk - sslpk --sslprivatekey -- sslprivatekey SSL private key SSL 私钥  
-sslca Sslca --sslcacertificate -- sslcacertificate SSL CA certificate SSL CA 证书  
-sslcert - sslcert --sslcertificate -- sslcertificate SSL certificate SSL 证书  
-sslcip - sslcip --sslcipher -- sslcipher SSL cipher 加密  
  --psettings -- psettings Custom filename for portable settings. Ignored if file does not exist.可移植设置的自定义文件名。如果文件不存在则忽略。 portable_settings.txt (if that file exists)Portable _ settings.txt (如果该文件存在的话)

Examples:

例子:

  • Start over using stored settings from session "xyz": 使用会话“ xyz”中存储的设置重新开始:
    • c:\path\to\heidisql.exe -d=xyz C: path to heidisql.exe-d = xyz
    • c:\path\to\heidisql.exe -description=xyz C: path to heidisql.exe-description = xyz
  • Connect with different username or port: 使用不同的用户名或端口连接:
    • c:\path\to\heidisql.exe -d=xyz -u=OtherUser
    • C: path to heidisql.exe-d = xyz-u = OtherUser
    • c:\path\to\heidisql.exe -d=xyz -P=3307
    • C: path to heidisql.exe-d = xyz-p = 3307
  • Connect to a non-stored session: 连接到非存储会话:
    • c:\path\to\heidisql.exe -h="127.0.0.1" -u=root -p=Mypass -P=3307
    • C: path to heidisql.exe-h = “127.0.0.1”-u = root-p = Mypass-p = 3307
  • Open multiple .sql files in query tabs: 在查询选项卡中打开多个.sql 文件:
    • c:\path\to\heidisql.exe fileA.sql path\to\fileB.sql fileC.sql ...
    • C: path to heidisql.exe fileA.sql path to fileB.sql file.sql...
  • Use custom portable settings file: 使用自定义便携式设置文件:
    • c:\path\to\heidisql.exe --psettings=c:\temp\p.txt
    • C: path to heidisql.exe -- psettings = c: temp p.txt

The database tree

数据库树

When you have a large amount of tables, views or whatever in your database(s), you probably want to group these by their type, for a better overview. Just right click the tree and activate Tree style options > Group objects by type:

当您的数据库中有大量表、视图或其他内容时,您可能希望按类型对这些表、视图或其他内容进行分组,以获得更好的概述。只需右键单击树并激活树样式选项 > 按类型分组对象:

Tree folders

You can also mark important items as so called favorites, by mouse click on the very left area of a table. Afterwards, you can limit the tree to show only favorites by a click on the new "Show only favorites" button at the top:

你也可以通过鼠标点击表格的左侧区域,将重要的项目标记为所谓的收藏夹。然后,你可以通过点击顶部的“只显示收藏夹”按钮来限制树只显示收藏夹:

Favorites

Creating a table

创建一个表

HeidiSQL comes with a feature-rich GUI for creating and editing a table structure. Just right click the datatabase in which you want to create a table, then point on "Create new", then click "Table":

HeidiSQL 提供了一个功能丰富的 GUI,用于创建和编辑表结构。只需右键单击要在其中创建表的数据库,然后指向“创建新”,再单击“表”:

CREATE TABLE IF NOT EXISTS IF NOT EXISTS IF NOT EXISTS

Done that, you'll see the table editor like in the following picture:

这样做,你会看到如下图所示的表格编辑器:

Table editor

Creating a view

创建视图

Click "Create new", then click "View", to show up the view editor. Creating a view is basically like writing a SELECT query. Give it a name, and click the save button to create it. HeidiSQL shows the data of the view in the "Data" tab, like for tables.

单击“ Create new”,然后单击“ View”,显示视图编辑器。创建视图基本上就像编写一个 SELECT 查询。给它一个名字,然后点击保存按钮来创建它。HeidiSQL 在“ Data”选项卡中显示视图的数据,就像表一样。

One thing you might notice is that MySQL and MariaDB are reformatting the SELECT query in the view when you save it. This destroys indentation, and converts the whole query into a one-liner. HeidiSQL tries its best to restore the original code of the view, by loading it from the *.frm file on the server. However, this fails in many cases, often due to restricted file privileges. For such cases, the only way to make it readable again is to use HeidiSQL's reformatter (Ctrl+F8).

您可能会注意到,MySQL 和 MariaDB 在保存 SELECT 查询时会在视图中重新格式化它。这将销毁缩进,并将整个查询转换为一行程序。HeidiSQL 尽力恢复视图的原始代码,方法是从 * 加载视图。服务器上的 frm 文件。但是,这在许多情况下都会失败,通常是由于受到限制的文件特权。对于这种情况,使其再次可读的唯一方法是使用 HeidiSQL 的重新格式化程序(Ctrl + F8)。

View editor

Creating a stored procedure

创建存储过程

Just right click the datatabase in which you want to create a procedure, then point on "Create new", then click "Procedure" or "Function". Done that, you'll see the procedure editor like in the following picture:

只需右键单击要在其中创建过程的数据库,然后指向“创建新”,再单击“过程”或“函数”。这样做,你会看到如下图所示的过程编辑器:

Procedure editor

Creating a trigger

创建一个触发器

 

Trigger editor

Creating a scheduled event

创建计划事件

 

Event editor

The Data tab

数据标签

On the data tab, the contents of the currently selected table or view are displayed. This is one of the most useful and powerful features of HeidiSQL. You will see different colors for the various groups of data types. These colors are customizable in Tools > Preferences > Data appearance.

在数据选项卡上,显示当前选定的表或视图的内容。这是 HeidiSQL 最有用和最强大的特性之一。您将看到各种数据类型组的不同颜色。这些颜色可以在工具 > 参数设置 > 数据外观中定制。

Pressing F2 or one-long-click in a grid cell will start the editor mode. This will allow you inserting ordinary values into a row. For inserting special values, such as SQL functions, NULL or GUIDs, right click a cell, and point to the Insert value > submenu.

在网格单元格中按 f2或单击一次就会启动编辑器模式。这将允许您将普通值插入到行中。要插入特殊值,如 SQL 函数、 NULL 或 guid,请右键单击单元格,并指向 Insert value > submenu。

Quick filters: Right click a value in the grid, then click Quick filter to get various one-click options to create a WHERE clause on the grid values. This filter can be base on either the focused cell in the grid, a prompted value, or on the contents of your clipboard.

快速过滤器: 右键单击网格中的一个值,然后单击快速过滤器以获得各种一键选项,从而在网格值上创建一个 WHERE 子句。此筛选器可以基于网格中的聚焦单元格、提示值或剪贴板中的内容。

In the Quick filter sub menu, you will find a More values sub-sub-menu. Pointing to that menu, HeidiSQL quickly collects and displays the top 30 items in the focused column, grouped by their value:

在快速过滤子菜单,你会发现一个更多的价值子菜单。指向该菜单,HeidiSQL 快速收集并显示重点列中前30项,按其值分组:

More values

Finding specific values in such a grid can be a pain. For a simple client side filter, you can enter some value in the filter panel. Activate it in Edit > Filter panel (Ctrl+Alt+F):

在这样的网格中查找特定的值可能是一件痛苦的事情。对于一个简单的客户端过滤器,您可以在过滤器面板中输入一些值。在编辑 > 过滤面板中激活它(Ctrl + Alt + f) :

Filter panel

HeidiSQL can also assists you with a Search and replace dialog (Find mode: Ctrl+F, Replace mode: Ctrl+R). That dialog can be used on SQL query tabs too.

HeidiSQL 还可以帮助您创建搜索和替换对话框(查找模式: Ctrl + f,替换模式: Ctrl + r)。该对话框也可用于 SQL 查询标签。

Search and replace

Binary values, also called BLOBs, are by default displayed in hexadecimal format, which is mostly unreadable for a human being. For cases in which such BLOBs contain readable text, HeidiSQL offers to toggle between hex-mode and text-mode. Press or "unpress" the white button with the purple "0x" on it:

二进制值,也称为 blob,默认以十六进制格式显示,这对于人类来说通常是不可读的。对于这种 blob 包含可读文本的情况,HeidiSQL 提供在十六进制模式和文本模式之间切换。按下或“取消”带有紫色“0x”的白色按钮:

hex

Probably you have a table with one or more integer columns which represent UNIX timestamps. HeidiSQL can display such integer columns as date/time values, so you can better read them:

您可能有一个表,其中有一个或多个整数列,表示 UNIX 时间戳。HeidiSQL 可以将整数列显示为日期/时间值,因此您可以更好地读取它们:

UNIX timestamps

Running SQL queries

运行 SQL 查询

HeidiSQL has a "Query" tab by default. You can create more than this default one by pressing Ctrl+T, or by right clicking the main tabs, then click "New query tab". In such a query tab, you can write your own database queries, or load a .sql file from your harddisk. Pressing F9, or the button with the blue "play" icon on it executes your query or queries.

HeidiSQL 默认有一个“ Query”选项卡。您可以通过按 Ctrl + t 或右键单击主标签,然后单击“新建查询标签”来创建更多的默认标签。在这样的查询选项卡中,您可以编写自己的数据库查询,或者加载。Sql 文件从您的硬盘。按 F9,或者按下带有蓝色“播放”图标的按钮,它就会执行你的查询或查询。

Compound queries e.g. for creating a function often have a semicolon inside the query. As HeidiSQL separates queries at each semicolon, you will get syntax errors when you run such commands. You can set a different query delimiter for such purposes, e.g. "!!", as shown in the screenshot:

例如,用于创建函数的复合查询通常在查询内部有一个分号。当 HeidiSQL 在每个分号上分隔查询时,运行这些命令时会出现语法错误。可以为此目的设置不同的查询分隔符,例如“ ! !”,如截图所示:

Query delimiter

Alternatively, you can change the delimiter via code:

或者,您可以通过代码更改分隔符:

DELIMITER !!
-- your code
DELIMITER ;

DELIMITER! ! ——您的代码
分隔符;

On the right hand of each query tab, you have the "query helpers" panel, with table columns, reserved words, SQL functions etc.
Having a table selected in the left tree, the first tree item in the helpers show "Columns in <selected-table>". The contained "Generate..." menu items use the selected column names to create a quick query for you in the editor:

在每个查询选项卡的右侧,有“ query helpers”面板,包括表列、保留字、 SQL 函数等。在左边的树中选择了一个表,helpers 中的第一个树项显示“ Columns in < selected-table >”。包含的“ Generate...”菜单项使用选定的列名在编辑器中为您创建一个快速查询:

Quickly generate basic queries

To see how your query performs in MariaDB or MySQL, you can activate the "Query profile" option in the helpers box on the right. Then, run your query or queries, and see what the profile timings show. This is basically what SHOW PROFILE in MySQL 5.0.37 and later releases does.

要查看您的查询在 MariaDB 或 MySQL 中的执行情况,您可以激活右侧 helpers 框中的“ Query profile”选项。然后,运行查询或查询,看看配置文件计时显示了什么。这基本上就是 MySQL 5.0.37及以后版本中的 SHOW PROFILE 所做的。

Query profile

HeidiSQL supports parameterized SQL queries: Activate it per click on the checkbox "Bind parameter", and start writing a query with parameters, e.g. select ':p'.

HeidiSQL 支持参数化 SQL 查询: 在“ Bind parameter”复选框上的每次点击激活它,并开始编写带有参数的查询,例如选择’: p’。

Query parameters

The first part of the bind parameter implementation was done by Adrian Granger.

绑定参数实现的第一部分是由 Adrian Granger 完成的。

HeidiSQL can execute a batch of queries (= multiple queries, separated by semicolon) in one go. That way, execution gets dramatically faster, especially when having tons of mini queries. To activate that "one go execution", just click the drop down menu of the blue "play" button, then click "Send batch in one go":

HeidiSQL 可以一次执行一批查询(= 多个查询,以分号分隔)。通过这种方式,执行速度会大大加快,尤其是在拥有大量迷你查询的情况下。要启动「一次过执行」 ,只需点击蓝色「播放」按钮的下拉式功能表,然后点击「一次过发送批处理」 :

Batch execution

MS SQL users should turn this on when having trouble with declaring a variable, e.g.:

用户在声明变量时遇到困难时应该打开这个功能,例如:

Declare @RowNo int =1;
SELECT @RowNo;

1; SELECT@RowNo;

SQL export

SQL 导出

HeidiSQL can generate nice SQL export files for you. This is basically what mysqldump also does. However, you can also tell HeidiSQL to put the results of the export into

HeidiSQL 可以为您生成良好的 SQL 导出文件。这基本上也是 mysqldump 所做的。但是,您也可以告诉 HeidiSQL 将导出结果放入

  • an .sql file 一个.sql 文件
  • a ZIP compressed .sql file 一个 ZIP 压缩的.sql 文件
  • into your clipboard 放进你的笔记板里
  • another database on the same server
  • 同一台服务器上的另一个数据库
  • a new or existing database on a server on which you have a configured HeidiSQL session
  • 在服务器上配置了 HeidiSQL 会话的新数据库或现有数据库
SQL export
Database(s) 资料库
Controls whether to a) drop an existing database on the target server first, and b) create it. 控制是否先在目标服务器上删除现有数据库,然后再创建它
This is meant for the target server, not the source server!这是针对目标服务器的,而不是源服务器!
Table(s) 附表
Same as above, just for tables, views, procedures etc. When checked, the table(s) will be dropped first, and/or created afterwards.
如上所述,仅用于表、视图、过程等。选中后,表将首先被删除,然后/或创建。
Data 境监察及审核资料
How the rows are created on the target server. Select "No data" to make a structure-only export. Default is "INSERT".
如何在目标服务器上创建行。选择“ No data”以创建仅结构化导出。默认值为“ INSERT”。
Max INSERT size 最大插入大小
Defines the maximum size of the extended INSERT statements, which can hold multiple rows in one statement. Note that a MariaDB/MySQL server limits the size of a query sent to the server by the server variable max_allowed_packet. Be sure to use a lower value in this dialog, otherwise MariaDB/MySQL will kill your connection when importing that file.
定义扩展 INSERT 语句的最大大小,该语句可以在一个语句中保存多行。注意,MariaDB/MySQL 服务器限制服务器变量 max _ allowed _ packet 发送到服务器的查询的大小。一定要在这个对话框中使用较小的值,否则当导入该文件时,MariaDB/MySQL 将杀死您的连接。
Output 输出
Either select a filename (zip compressed or uncompressed), a directory in which HeidiSQL will place .sql files, clipboard, another database or a configured HeidiSQL (and a database name below).
选择一个文件名(zip 压缩或未压缩) ,这是 HeidiSQL 将放置的目录。Sql 文件、剪贴板、另一个数据库或配置的 HeidiSQL (以及下面的数据库名称)。
Filename, Directory, or Database 文件名、目录或数据库
Depends on what you selected in the "output" pulldown menu.
取决于您在“输出”下拉菜单中选择的内容。

Importing files

导入文件

HeidiSQL can import .sql files with data rows and/or structure, .csv files with data rows and binary files for BLOBs.

HeidiSQL 可以用数据行和/或结构导入.sql 文件,用数据行导入.csv 文件,用二进制文件导入 blob。

Importing .sql files

导入.sql 文件

At first, activate the database you want the import to run in. Then, go to File > "Run SQL file", and select the file to import. Below the filename input box, you will find an Encoding dropdown menu. Using "Auto detect" is a common way to get broken data afterwards - so if are sure about the encoding in that file, you should definitely select the right one, e.g. "UTF-8". After clicking "OK", HeidiSQL will start to execute the contained commands immediately, and you can watch the progress:

首先,激活要在其中运行导入的数据库。然后,转到 File > “ Run SQL File”,选择要导入的文件。在文件名输入框下面,你会找到一个下拉菜单编码。使用“自动检测”是一种常见的方法来获取事后损坏的数据——因此,如果确定文件中的编码,您肯定应该选择正确的编码,例如“ UTF-8”。点击“ OK”后,HeidiSQL 将立即开始执行所包含的命令,您可以观察进度:

SQL import

Importing .csv files (text files)

导入.csv 文件(文本文件)

A .csv file is a text file with data rows for one table. You can import such a file into a table via Tools > "Import CSV file". You will have to tell HeidiSQL the format of the file (line terminator, enclosing character etc.).

答:。Csv 文件是一个文本文件,包含一个表的数据行。您可以通过 Tools > “ Import CSV file”将这样的文件导入到表中。您必须告诉 HeidiSQL 文件的格式(行结束符、封闭字符等)。

CSV import

Importing binary or text files into BLOBs

将二进制或文本文件导入到 blob 中

Via Tools > "Insert files into TEXT/BLOB fields", you can insert new rows from all kind of files into your tables. First, select the database and the table you want to put the files into. Then, click on the green "Add" button, to add one or more files to the listing. In the upper listing you will have to tell HeidiSQL with placeholders in which column the file content goes. In the "Value" column, click besides the right field name and select '%filecontent%'. Some other placeholders are available in that dropdown. You can also wrap the placeholders (or even static text) with some SQL function. For example if you want the file name in lowercase, you apply LOWER('%filename%').

通过 Tools > “ Insert files into TEXT/BLOB fields”,您可以将所有类型的文件中的新行插入到表中。首先,选择要将文件放入的数据库和表。然后,单击绿色的“添加”按钮,向列表添加一个或多个文件。在上面的清单中,您必须用占位符告诉 HeidiSQL 文件内容放在哪一列。在“ Value”列中,单击右字段名并选择“% filecontent%”。下拉列表中还有其他占位符。您还可以使用一些 SQL 函数来封装占位符(甚至静态文本)。例如,如果希望文件名为小写,则应用 LOWER (“% filename%”)。

Import files

HeidiSQL portable

便携式

If HeidiSQL finds a portable.lock file, or a portable_settings.txt, or the custom filename as noted above, it starts in portable mode. Which means basically that all settings are restored from that file and when exiting stored again into that file.

如果 HeidiSQL 找到一个 portable.lock 文件,或者一个 portable _ settings.txt 文件,或者上面提到的自定义文件名,它将以可移植模式启动。这意味着基本上所有的设置都还原,从该文件和退出存储到该文件。

When you download the portable package, that portable_settings.txt needs to be manually copied from your old portable HeidiSQL directory. Not doing so will show you an empty session manager.

当您下载便携包时,需要从旧的可移植 HeidiSQL 目录手动复制 portable _ settings.txt。不这样做将显示一个空的会话管理器。

License

许可证

HeidiSQL is OpenSource and released under GPL (GNU GENERAL PUBLIC LICENSE). See the license.txt for more details.

HeidiSQL 是 OpenSource,并且使用 GPL (GNU通用公共许可协议公共许可证)发布。

Probably HeidiSQL saved you a lot of time and you like it. In this case you may make a donation here.

也许海迪斯可以为你节省很多时间,你也喜欢这样。在这种情况下,你可以在这里捐款。

Credits

学分

Author: Ansgar Becker (Germany)
Ansgar Becker

作者: Ansgar Becker (德国)

Third party components and graphics:

第三方组件和图形:

  • Joachim Marder (VirtualTreeView, GLPL)
  • Joachim Marder (VirtualTreeView,GLPL)
  • Christian Budde (SynEdit, MPL)
  • 克里斯蒂安 · 巴德(SynEdit,MPL)
  • Serhiy Perevoznyk (JumpList)
  • Iztok Kacin (Cromis.DirectoryWatch, BSD License)
  • 卡星(Cromis. DirectoryWatch,BSD 许可证)
  • Thomas Müller (GNU Gettext for Delphi, BSD License)
  • Thomas Müller (用于 Delphi 的 GNU Gettext,BSD 许可)
  • Rodrigo Ruz (VCL Styles Utils)
  • 罗德里戈 · 鲁兹(VCL Styles Utils)
  • Charlie Etienne (Material Theme)
  • 查理艾蒂安(材料主题)
  • Mahdi Safsafi (Delphi Detours Library)
  • Volker Siebert (SizeGrip, M.I.T. License)
  • Volkersiebert (麻省理工学院许可证)
  • Jordan Russell (Inno Setup)
  • 乔丹 · 拉塞尔(Inno Setup)
  • Mathias Rauen (madExcept)
  • Mathias Rauen (mathexcept)
  • Icons8 (New high resolution icons, icons8.com)
  • Icons8(New high resolution icons,Icons8.com)
  • Mark James (Silk icons, Creative Commons 2.5)
  • 马克 · 詹姆斯(丝绸图标,知识共享2.5)
  • Sven Lorenz (graphics) 斯文洛伦茨(图形)

Former development contributors:

以前的发展贡献者:

  • David Dindorp (Denmark): threading, complex stuff, thinking
  • 大卫 · 丁多普(丹麦) : 线程,复杂的东西,思考
  • Adrien Granger (France): query parameters Adrien Granger (法国) : 查询参数
  • Francisco Ernesto Teixeira (Brazil): motivation, ideas
  • 弗朗西斯科 · 埃内斯托 · 特谢拉(巴西) : 动机,想法

Thanks to Transifex.com for a free translation account, and all the registered translators.

感谢 transitfex. com 提供的免费翻译帐户,以及所有注册的译者。

1000 thanks for great database software:

1000感谢伟大的数据库软件:

  • Michael 'Monty' Widenus and his fellows for founding MySQL in 1995 and MariaDB in 2009
  • 迈克尔 · 蒙蒂 · 威德纳斯和他的同事们在1995年创立了 MySQL,在2009年创立了 MariaDB
  • Microsoft for their feature-rich SQL Server, ported from Sybase in 1989
  • 微软的功能丰富的 SQL Server,1989年从 Sybase 移植过来
  • Michael Stonebraker and Larry Rowe for evolving PostgreSQL from Ingres in 1996
  • 1996年,迈克尔·斯通布雷克和 Larry Rowe 在 Ingres 发表 PostgreSQL 文章
  • Dwayne Richard Hipp for authoring SQLite in 2000
  • 德韦恩 · 理查德 · 海普于2000年创作了 SQLite

公司简介

 

自1996年以来,公司一直专注于域名注册、虚拟主机、服务器托管、网站建设、电子商务等互联网服务,不断践行"提供企业级解决方案,奉献个性化服务支持"的理念。作为戴尔"授权解决方案提供商",同时提供与公司服务相关联的硬件产品解决方案。
备案号: 豫ICP备05004936号-1

联系方式

地址:河南省郑州市经五路2号

电话:0371-63520088

QQ:76257322

网站:800188.com

电邮:该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。