Bug #114665 The file generated by the mysqldump tool lacks important information.

Submitted: 17 Apr 2024 8:30 Modified: 22 Apr 2024 9:43
Reporter: EN KAI Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:8.0.36 OS:Red Hat (7.6)
Assigned to: CPU Architecture:x86

[17 Apr 2024 8:30] EN KAI
Description:
The mysqldump backs up databases bak_1 and bak_2. The third line comment in the result file contains the information 'Database: bak_1', while bak_2 is missing.

-- Host: localhost    Database: bak1(while bak_2 is missing)

How to repeat:

1- Create user for backup:
create user 'u_bak'@'%' identified with mysql_native_password by '*****';

2- Configure appropriate permissions:
grant select,reload,process,lock tables,replication client,replication_slave_admin,show view,trigger on *.* to 'u_bak'@'%'; 

3- Create two test databases:

mysql> create database bak1;
Query OK, 1 row affected (0.01 sec)

mysql>  create database bak2;
Query OK, 1 row affected (0.01 sec)

4:The creation of two test tables respectively:

mysql> create table  bak1.t1(id int not null auto_increment,a varchar(20) default null,b int default null,c datetime not null default current_timestamp,primary key (id)) engine=innodb charset=utf8mb4;

mysql>  create table bak1.t2 like bak1.t1;
Query OK, 0 rows affected (0.02 sec)

mysql> create table bak2.t1 like bak1.t1;
Query OK, 0 rows affected (0.02 sec)

mysql>  create table bak2.t2 like bak1.t1;
Query OK, 0 rows affected (0.02 sec)

5:The insertion of test data:

mysql> insert into bak1.t1(a,b) values ('one',1),('two',2);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> insert into bak1.t2(a,b) select a,b from bak1.t1;
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> insert into bak2.t1(a,b) select a,b from bak1.t1;
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> insert into bak2.t2(a,b) select a,b from bak1.t1;
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

6- The backup of multiple databases:
[mysql@Mysql01 data]$ mysqldump -u u_bak -p'*****' -B bak1 bak2 >bak1_bak2.sql

7- The validation of the generated result file content:

[mysql@Mysql01 data]$ cat bak1_bak2.sql
-- MySQL dump 10.13  Distrib 8.0.36, for Linux (x86_64)
--
-- Host: localhost    Database: bak1
-- ------------------------------------------------------
-- Server version       8.0.36

Suggested fix:
The content of the result file is inaccurate! Fix by adding the missing bak2 information to the third line of the .sql result file.

Accurate information example:
[mysql@Mysql01 data]$ cat bak1_bak2.sql
-- MySQL dump 10.13  Distrib 8.0.36, for Linux (x86_64)
--
-- Host: localhost    Database: bak1 bak2 
-- ------------------------------------------------------
-- Server version       8.0.36
[17 Apr 2024 8:42] EN KAI
mysqldump result file

Attachment: bak1_bak2.sql (application/octet-stream, text), 4.59 KiB.

[22 Apr 2024 9:43] MySQL Verification Team
Hello EN KAI,

Thank you for the report and feedback.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.