# 数据计算

**URL:** https://www.isharkfly.com/c/data-ai/16.md

[Latest](https://www.isharkfly.com/latest.md) · [Categories](https://www.isharkfly.com/categories.md) · [Tags](https://www.isharkfly.com/tags.md)

---

## [About the 数据计算 category](https://www.isharkfly.com/t/about-the-category/214)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0

</div>

(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.) Use the following paragraphs for a longer d…

---

## [PostgreSQL 创建用户表的时候提示 user 错误](https://www.isharkfly.com/t/postgresql-user/18630)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 4, 2026, 5:34pm UTC](https://www.isharkfly.com/t/postgresql-user/18630 "2026-02-04T17:34:47Z")

</div>

\[42601\] ERROR: syntax error at or near "user" Position: 14 问题 就说了用户 (user) 这个字别乱用。 因为 user 在 PostgreSQL 是保留关键字。 直接用于表名或列名会导致语法错误。 解决方法是用双引号将"user"括起来，或者更推荐的做法是改用users或user\_id等避免冲突的名字。 直接使用会引发SQL语法错误。 所以创建用户表的时…

---

## [想着是吐槽下 MSSQL 字段顺序不能调整的问题](https://www.isharkfly.com/t/mssql/18484)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [November 26, 2025, 2:00pm UTC](https://www.isharkfly.com/t/mssql/18484 "2025-11-26T14:00:08Z")

</div>

想着是吐槽下 MSSQL 字段顺序不能调整的问题，随手搜索了下数据库的排名。 想着最近都在换 PGSQL 的库，就顺便吐槽了下 MySQL 和 Oracle。 没有想到的是，我这里还没火，微信上吵起来。 不过也好，有争论才说明这个问题的也比较突出了，否则连争都不需要争。

---

## [PGSQL 列出所有的表](https://www.isharkfly.com/t/pgsql/18482)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [November 25, 2025, 7:18pm UTC](https://www.isharkfly.com/t/pgsql/18482 "2025-11-25T19:18:27Z")

</div>

可以直接使用 SQL 列出所有的表： SELECT tablename FROM pg\_tables WHERE schemaname = 'public'; 或者输入 \\dt 也可以。 isharkfly\_www=# \\dt List of tables Schema | Name | Ty…

---

## [MySQL 终于快被 Oracle 玩死](https://www.isharkfly.com/t/mysql-oracle/18480)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 5\
**Last updated:** [November 25, 2025, 2:50am UTC](https://www.isharkfly.com/t/mysql-oracle/18480 "2025-11-25T02:50:46Z")

</div>

虽然大家都知道当 MySQL 给了 Oracle 后的结果是什么。 但上面的这张图片应该是大家都没有想到的。 到 2025 年了，MySQL 看来终究是快死在 Oracle 的手里了。 虽然 MariaDB 也有所发展并能再撑一段时间，但终究还是从 Oracle 那边的分支过来。 不少公司抱着的态度就是能不用就不用，能少用就少用，谁知道那天 Oracle 又开始抽风了。 用不了几年 MySQL 可能终究会走进历史…

---

## [MSSQL 字段顺序无法调整](https://www.isharkfly.com/t/mssql/18479)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [November 24, 2025, 8:42pm UTC](https://www.isharkfly.com/t/mssql/18479 "2025-11-24T20:42:16Z")

</div>

虽然不建议这样做，但可以使用 SQL Server Management Studio (SSMS) 更改表中列的顺序。 这需要重新创建表。 起因是最近项目对 MSSQL 数据库的表进行了修改，添加了字段。 后来发现 MSSQL 的字段顺序无法调整，也不是完全不能调整，只是对表需要删除后重建。 这个就太扯了，不能没事调整下表就重建表吧。 官方给出的解决方案更牛，就是你用视图吧，如果你非要调整。 我们不建议擅自调整列的顺序，特…

---

## [PostgresSQL 执行 SQL 提示错误](https://www.isharkfly.com/t/postgressql-sql/18476)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [November 23, 2025, 3:50pm UTC](https://www.isharkfly.com/t/postgressql-sql/18476 "2025-11-23T15:50:16Z")

</div>

执行 SQL 的提示错误： permission denied for table users 虽然把用户的权限给了数据库，但表的所有用户在导入的使用还是使用的导入用户。 需要把这个用户修改为通过程序访问的用户。 麻烦点，就是需要一个一个的改。 使用 SQL： ALTER TABLE employees OWNER TO joe; 也是可以的。

---

## [PGSQL 的序列需要自定义](https://www.isharkfly.com/t/pgsql/18440)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [November 17, 2025, 2:25pm UTC](https://www.isharkfly.com/t/pgsql/18440 "2025-11-17T14:25:43Z")

</div>

与 MySQL 可以在表上直接定义序列不同， PGSQL 的序列需要自行定义。 通常会导致有多少个表就至少需要定义多少自增序列。 不过，Oracle 也采用的是这个方式。

---

## [MySQL 表名应该大写还是小写](https://www.isharkfly.com/t/mysql/18369)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 3\
**Last updated:** [October 25, 2025, 10:15am UTC](https://www.isharkfly.com/t/mysql/18369 "2025-10-25T10:15:40Z")

</div>

mysql 表名和字段名应该大写还是小写。 核心结论：强烈推荐全部使用小写字母，并用下划线 \_ 分隔单词 (即 snake\_case 风格)。 理由 有关定义的理由，请参考后面的解释。 需要明确的是，因为 Linux 是大小写敏感的，如果不这么规定会有迁移问题。

---

## [Pi 升级后，终于看到了想要的字符集 utf8mb4\_0900\_ai\_ci](https://www.isharkfly.com/t/pi-utf8mb4-0900-ai-ci/18366)

<div class="topic-metadata">

**Author:** [@隔壁老王的猫](https://www.isharkfly.com/u/%E9%9A%94%E5%A3%81%E8%80%81%E7%8E%8B%E7%9A%84%E7%8C%AB)\
**Replies:** 0\
**Last updated:** [October 20, 2025, 7:57pm UTC](https://www.isharkfly.com/t/pi-utf8mb4-0900-ai-ci/18366 "2025-10-20T19:57:00Z")

</div>

utf8mb4\_0900\_ai\_ci 这个字符集在老版本上没有。 要想用的话，还是升级下。 11 以上的版本，级别上给补齐了。

---

## [MariaDB 10061 错误原因及解决方法](https://www.isharkfly.com/t/mariadb-10061/18364)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 1\
**Last updated:** [October 20, 2025, 6:06pm UTC](https://www.isharkfly.com/t/mariadb-10061/18364 "2025-10-20T18:06:43Z")

</div>

MariaDB 安装后提示 10061 错误是什么原因 默认访问限制 在默认安装情况下，网络只对本地 127.0.0.1 的地址开放。 需要把上面的地址修改为 0.0.0.0 然后重启服务器就好了。

---

## [打开 quartz scheduler.db 的工具](https://www.isharkfly.com/t/quartz-scheduler-db/18346)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 4\
**Last updated:** [October 16, 2025, 4:15pm UTC](https://www.isharkfly.com/t/quartz-scheduler-db/18346 "2025-10-16T16:15:18Z")

</div>

quartz scheduler.db 用什么工具打开。 直接用 IDEA 吧。 第一次需要下载驱动。 随后直接使用 IDEA 的数据查看器运行即可。

---

## [Mysql utf8mb4\_0900\_ai\_ci 是什么字符集](https://www.isharkfly.com/t/mysql-utf8mb4-0900-ai-ci/18195)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [October 15, 2025, 9:10pm UTC](https://www.isharkfly.com/t/mysql-utf8mb4-0900-ai-ci/18195 "2025-10-15T21:10:41Z")

</div>

utf8mb4\_0900\_ai\_ci 是 MySQL 8.0 及更高版本中引入的一种 utf8mb4 字符集的排序规则 (Collation)。 让我们来详细解读一下这个名称： utf8mb4: 这代表了字符集本身。utf8mb4 是 UTF-8 编码的一种实现，能够存储四个字节的 UTF-8 字符。这意味着它可以完整地支持 Unicode 字符集中的所有字符，包括表情符号（emojis）、Cyrillic、Japanese、C…

---

## [Mariadb 10.11 有没有 utf8mb4\_0900\_ai\_ci 字符集](https://www.isharkfly.com/t/mariadb-10-11-utf8mb4-0900-ai-ci/17812)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [October 7, 2025, 5:55pm UTC](https://www.isharkfly.com/t/mariadb-10-11-utf8mb4-0900-ai-ci/17812 "2025-10-07T17:55:19Z")

</div>

MariaDB 10.11 版本确实没有 utf8mb4\_0900\_ai\_ci 排序规则。 我之前的回答是基于 MariaDB 致力于兼容 MySQL 的大趋势，并且在一些早期版本中确实引入了部分基于 Unicode 9.0.0 的特性，但关于 utf8mb4\_0900\_ai\_ci 的具体支持时间点我判断有误。 事实是： utf8mb4\_0900\_ai\_ci 是 MySQL 8.0 的默认排序规则，它是 MySQL 独有的，基于…

---

## [MSSQL 查询指定行数的方法](https://www.isharkfly.com/t/mssql/17430)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [June 12, 2025, 3:46pm UTC](https://www.isharkfly.com/t/mssql/17430 "2025-06-12T15:46:44Z")

</div>

MSSQL SQL 查询返回指定的行数

---

## [PostgreSQL 配置参数的路径](https://www.isharkfly.com/t/postgresql/17363)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [May 27, 2025, 3:03pm UTC](https://www.isharkfly.com/t/postgresql/17363 "2025-05-27T15:03:46Z")

</div>

PostgreSQL 配置参数可以通过 psql 上面来进行查看。 命令为： SHOW config\_file; 输入上面的命令后，就可以看到配置参数的路径。 postgres=# SHOW config\_file; config\_file ----------------------------------------- /etc/postgresql/16/main/postgresql.co…

---

## [MySQL FLUSH HOSTS 命令详解](https://www.isharkfly.com/t/mysql-flush-hosts/17276)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [May 4, 2025, 4:30pm UTC](https://www.isharkfly.com/t/mysql-flush-hosts/17276 "2025-05-04T16:30:45Z")

</div>

Mysql FLUSH HOSTS 命令解读 可以在控制台上直接执行。 通常会显示为执行成功。

---

## [MySQL 数据库 Ubuntu 配置文件位置](https://www.isharkfly.com/t/mysql-ubuntu/17273)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [May 4, 2025, 4:17pm UTC](https://www.isharkfly.com/t/mysql-ubuntu/17273 "2025-05-04T16:17:49Z")

</div>

在对数据库进行调整的时候，我们需要了解下 MySQL 的配置文件。 使用命令：mysql --help 命令输出为： root@raspberrypi:~# mysql --help mysql Ver 15.1 Distrib 10.11.11-MariaDB, for debian-linux-gnu (aarch64) using EditLine wrapper Copyright (c) 2000, 2018, Or…

---

## [MySQL参数max\_connect\_errors详解与最佳实践](https://www.isharkfly.com/t/mysql-max-connect-errors/17275)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [May 4, 2025, 4:21pm UTC](https://www.isharkfly.com/t/mysql-max-connect-errors/17275 "2025-05-04T16:21:29Z")

</div>

MySQL性能参数详解之Max\_connect\_errors 使用介绍 默认值 在默认的安装情况下，默认值为：100 修改配置 在文件 vi /etc/my.cnf 文件中，添加下面的参数： \[mysqld\] max\_connect\_errors=6000 然后重启服务器。 重新查询参数状态。 配置说明 当此值设置为10时，意味着如果某一客户端尝试连接此MySQL服务器，但是失败（如密码错误等等）10次，则MyS…

---

## [My.cnf files 的位置](https://www.isharkfly.com/t/my-cnf-files/8080)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [March 28, 2017, 1:59pm UTC](https://www.isharkfly.com/t/my-cnf-files/8080 "2017-03-28T13:59:12Z")

</div>

MariaDB 通常通过编辑 my.cnf 文件来对数据库进行控制。 默认的文件路径为： /etc/my.cnf

---

## [什么是 SQL 的 Aggregate Functions（聚合函数）](https://www.isharkfly.com/t/sql-aggregate-functions/15945)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 2\
**Last updated:** [April 18, 2025, 2:45pm UTC](https://www.isharkfly.com/t/sql-aggregate-functions/15945 "2025-04-18T14:45:27Z")

</div>

它是⼀个返回单个值的数学函数。 SQL中的聚合函数是： AVG（）——返回平均值 COUNT（）——返回⾏数 MAX（）——返回最⼤值 MIN（）——返回最⼩值 ROUND（）——基于⼗进制规范，此函数对数字字段进⾏舍⼊ SUM（）——返回总和

---

## [SQL连接类型及使用方法完全指南](https://www.isharkfly.com/t/sql/17205)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [April 18, 2025, 3:12am UTC](https://www.isharkfly.com/t/sql/17205 "2025-04-18T03:12:52Z")

</div>

SQL Join 查询的种类 想对 SQL Join 查询的相关知识进行了解。

---

## [Mysql/MariaDB gzip 方式的备份和恢复](https://www.isharkfly.com/t/mysql-mariadb-gzip/7764)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [October 6, 2012, 6:35pm UTC](https://www.isharkfly.com/t/mysql-mariadb-gzip/7764 "2012-10-06T18:35:46Z")

</div>

使用命令行方式对 MariaDB 数据库进行备份压缩和恢复的命令。 备份 下面的这个命令我们常用。 主要用途是把数据库使用 mysqldump 的方式备份到本地并且做成一个 gz 的文件。 上面的数据库备份需要在服务器上运行。 假设我们需要备份的数据库为：ossez\_analytics 那么需要运行的命令为： mysqldump -uroot -p ossez\_analytics| gzip \> /home/ubuntu/o…

---

## [Mysql/MariaDB 连接错误 ERROR 2002 (HY000)](https://www.isharkfly.com/t/mysql-mariadb-error-2002-hy000/7744)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [December 18, 2010, 7:41am UTC](https://www.isharkfly.com/t/mysql-mariadb-error-2002-hy000/7744 "2010-12-18T07:41:15Z")

</div>

连接错误的提示信息为：ERROR 2002 (HY000): Can't connect to server on 'XXX.XXX.XXX.XXX' (115) 问题和解决 根据官方的提示：Configuring MariaDB for Remote Client Access Guide | Server | MariaDB Documentation 出现上面问题的原因是从版本： MariaDB starting wit…

---

## [如何在 Ubuntu / Raspbian 上安装 MariaDB](https://www.isharkfly.com/t/ubuntu-raspbian-mariadb/15339)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [January 17, 2024, 9:47pm UTC](https://www.isharkfly.com/t/ubuntu-raspbian-mariadb/15339 "2024-01-17T21:47:47Z")

</div>

Raspberry Pi OS（原为Raspbian）是为树莓派基于Debian开发的操作系统。 从2015年起，树莓派基金会正式将其作为树莓派的官方操作系统。 Raspbian是由Mike Thompson和Peter Green创建的一个独立项目。第一个版本于2012年6月发布，至今仍在更新中。 Raspi 对树莓派系列的低性能ARM架构CPU进行了高度优化。 使用的安装命令 Rasbian 操作系统和 Ubuntu 的操作…

---

## [MSSQL 连接 Azure 管理数据库](https://www.isharkfly.com/t/mssql-azure/17099)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [March 20, 2025, 6:31pm UTC](https://www.isharkfly.com/t/mssql-azure/17099 "2025-03-20T18:31:43Z")

</div>

在对数据库进行连接之前，需要在本地计算机上创建一个 ODBC 对象。

---

## [ERROR 2006 (HY000): MySQL server has gone away](https://www.isharkfly.com/t/error-2006-hy000-mysql-server-has-gone-away/8065)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [July 24, 2015, 4:13am UTC](https://www.isharkfly.com/t/error-2006-hy000-mysql-server-has-gone-away/8065 "2015-07-24T04:13:03Z")

</div>

数据在导入和导出出现下面的错误： ERROR 2006 (HY000): MySQL server has gone away 日志如下： mysql\> source file.sql ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 2 Current database: …

---

## [MySQL的innodb\_buffer\_pool\_size参数优化配置指南](https://www.isharkfly.com/t/mysql-innodb-buffer-pool-size/17058)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 6:24pm UTC](https://www.isharkfly.com/t/mysql-innodb-buffer-pool-size/17058 "2025-03-13T18:24:17Z")

</div>

MySQL innodb\_buffer\_pool\_size 参数如何配置

---

## [Postgresql 修改数据库名](https://www.isharkfly.com/t/postgresql/17055)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [March 13, 2025, 1:22pm UTC](https://www.isharkfly.com/t/postgresql/17055 "2025-03-13T13:22:10Z")

</div>

pgAdmin 修改很方便。 选择数据库，然后选择属性。 在属性界面中修改为不同的数据库名就行。

---

## [MySQL字符集排序规则对比：utf8mb4版本差异](https://www.isharkfly.com/t/mysql-utf8mb4/17044)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [March 11, 2025, 8:22pm UTC](https://www.isharkfly.com/t/mysql-utf8mb4/17044 "2025-03-11T20:22:45Z")

</div>

utf8mb4\_0900\_as\_cs 和 utf8mb4\_bin 之间对比

[Next page](https://www.isharkfly.com/c/data-ai/16.md?page=1)
