问题标签 [mysql-8.0]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
9592 浏览

mysql-8.0 - Mysql 8.0.3:函数 regexp_replace 不存在

新项目使用regexp_replace,所以我将mysql安装更新到8.0.3。但仍然感觉没有任何改变 =)

琐碎查询:

版本:

0 投票
1 回答
254 浏览

sql - MySQL 8 中不完整的执行计划

我想在 MySQL 8.0 中获得查询的执行计划,但它给了我一个不完整的计划。

2018 年 9 月 8 日编辑:

为了展示一个简化的示例,原始查询以没有检索任何行的子查询结束。似乎 MySQL 的优化器将这些查询简化到完全修剪部分查询的程度。我修改了查询以获取有关子查询的数据。这是示例:

现在的查询是:

它现在显示(传统计划):

它现在显示除标量子查询之外的所有表的信息t6。它在哪里?

0 投票
2 回答
108 浏览

php - 哪里等于零这么慢

我正在为 DB 使用 Laravel 5.6 和 MySQL

我想用上面的代码获得购买次数最多的付费书籍。这很好,响应时间为 1700 毫秒。大约400条记录。

但是下面的代码几乎相同:

结果只有 34 条记录,但响应时间为 8000 毫秒。代码中唯一的区别是“相等”

为什么第二个查询这么慢?以及如何解决这个问题

0 投票
1 回答
2129 浏览

mysql - 对--compatible的无效模式:mysql40

我的 MacBook(下载版本)上安装了 MYSQL 8.0.12。当我尝试转储兼容版本的 mysql40 时,我收到错误消息Invalid mode to --compatible: mysql40。我 100% 有信心做到这一点。不是吗?mysql网站提到了如何使用它

对--compatible的无效模式:mysql40

0 投票
1 回答
267 浏览

mysql - MAX() and GROUP BY, need COUNT(*) of whole result

I have a SELECT query I'm executing which has a MAX() column and a GROUP BY clause, and in addition to the results of this query that I need to return to the client, I also need to return the total count of all results as well.

Essentially my query is this:

It'll usually have a WHERE clause too.

The unique_id is the primary key of the table.

When returning this data to the client, I also specify LIMIT and OFFSET clauses to limit the number of results being retrieved at one time. My problem is that I also need to display the total count of results that the above query would produce if it didn't have the LIMIT and OFFSET clauses, so that the client can later/incrementally retrieve the rest.

I know I can easily use a WITH temporary table to get what I want:

But I'm concerned about the efficiency of this. The sans-LIMIT-and-OFFSET query could return tens of thousands of rows, so I'm thinking that the WITH approach to getting the total count isn't the best way to do this.

Is there a more efficient way, which I'm not thinking of? Or is the WITH method the fine (e.g. is the MySQL server "smart" enough to not allocate the entire result set of the query to get the count)?


Example data

Assume this is the data in my table:

So my SELECT query would return this (assume the client specified LIMIT 4 OFFSET 0):

And then I'd use that query without the LIMIT and OFFSET clauses as a subquery and SELECT COUNT(*) from it, which would return 6, and I'd return both the 6 and the results to the client.

0 投票
4 回答
26654 浏览

mysql - 在 MySQL SERVER 8.0 中,PASSWORD 功能不起作用

PASSWORD在 MySQL 服务器版本 8.0.12 中执行函数时出错

我有以下查询:

我收到此错误:

错误代码:1064。您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在附近使用的正确语法

0 投票
8 回答
332668 浏览

php - PHP 与 MySQL 8.0+ 错误:服务器请求客户端未知的身份验证方法

我在 PHP 7.0 上运行 MySQL 版本 8。

当我尝试从 PHP 连接到我的数据库时出现以下错误:

连接错误:SQLSTATE [HY000] [2054] 服务器请求客户端未知的身份验证方法

PHP 可能会显示此错误

警告:mysqli_connect():第 10 行 D:\xampp\htdocs\reg\server.php 中的服务器请求客户端未知的身份验证方法 [caching_sha2_password]

我该如何解决这个问题?

0 投票
1 回答
110 浏览

mysql - Mysql 8 自定义字符串函数总是返回零

我现在坚持了一段时间。我在 MySQL8 中编写了一个简单的 slugify UDF,它利用了内置的regexp_replace()函数。

该函数的语法是有效的,但对于每个输入,它总是返回 0(零)。

我首先怀疑可能导致麻烦的特殊字符,但简化功能给出了相同的结果:

为了验证语法,我尝试用字符串替换 regexp_replace 函数并且效果很好,因此问题仅在将 regexp_replace() 分配给自定义函数中的变量或返回值时出现。

文档没有说您不能在 udf 中使用 regexp_replace,那么为什么返回 0 而没有任何错误或警告呢?

0 投票
2 回答
142 浏览

mysql - I tried to install MySQL Community, but it always install MySQL Commercial

When I write the follow code in cmd: "C:\mysql-installer-community-8.0.12.0.msi /passive", the MySQL version were installed is the commercial, not the Community. What am I doing wrong?

enter image description here

0 投票
1 回答
45 浏览

mysql - 使用 REGEXP_REPLACE 的奇怪结果 - 字符串被聚合

我正在尝试使用REGEXP_REPLACE用其他字母替换一些字母。

这是我的查询 - 我将使用sakila示例数据库:

这就是结果(MySql Workbench,8.0.11) - 正如你所看到的,结果是“聚合的”:

在此处输入图像描述

我试着用这个小提琴重现它重现它,但它不会重现。

为什么会这样?