"Multiple files found for the same tablespace ID" Error

This section provides a tutorial example on the 'Multiple files found for the same tablespace ID' error caused by an outdated database file left from an external MySQL server.

If you accidentally copied an old database directory the "data" directory of the MySQL server, you may get the "Multiple files found for the same tablespace ID" error as shown in this tutorial.

1. Try to start the MySQL server again.

herong$ sudo -u mysql mysqld --defaults-file=/mysql/mysql-server.cnf &

2. Check MySQL log file.

herong$ sudo tail -20 /mysql/mysqld.log

[MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.21) starting ...
[MY-013576] [InnoDB] InnoDB initialization has started.
[MY-012209] [InnoDB] Multiple files found for the same tablespace ID:
[MY-012202] [InnoDB] Tablespace ID: 104 = ['temp/User.ibd', 'book/Book.ibd']
[MY-012930] [InnoDB] Plugin initialization aborted with error Failed, ...
[MY-010334] [Server] Failed to initialize DD Storage Engine
[MY-010020] [Server] Data Dictionary initialization failed.
[MY-010119] [Server] Aborting
[MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.21)

3. Renaming the conflicting table file, or move the "temp" directory out of the "data" directory. It looks like this "temp" directory was copied to here by a mistake. It contains a table file temp/User.ibd with a ID of 104 used by an existing table file 'book/Book.ibd'.

herong$ sudo mv /mysql/data/temp/User.ibd /mysql/data/temp/User.ibd.bck

4. Start the MySQL server again. I see no errors.

herong$ sudo -u mysql mysqld --defaults-file=/mysql/mysql-server.cnf &

herong$ sudo tail -20 /mysql/mysqld.log
[MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.21) starting ...
[MY-013576] [InnoDB] InnoDB initialization has started.
[MY-013577] [InnoDB] InnoDB initialization has ended.

Table of Contents

 About This Book

 Introduction of SQL

 MySQL Introduction and Installation

 Introduction of MySQL Programs

 PHP Programs and MySQL Server

 Perl Programs and MySQL Servers

 Java Programs and MySQL Servers

 Datatypes and Data Literals

 Operations and Expressions

 Character Strings and Bit Strings

 Commonly Used Functions

 Table Column Types for Different Types of Values

 Using DDL to Create Tables and Indexes

 Using DML to Insert, Update and Delete Records

 Using SELECT to Query Database

 Window Functions for Statistical Analysis

 Use Index for Better Performance

 Transaction Management and Isolation Levels

 Locks Used in MySQL

 Defining and Calling Stored Procedures

 Variables, Loops and Cursors Used in Stored Procedures

 System, User-Defined and Stored Procedure Variables

 MySQL Server Administration

 Storage Engines in MySQL Server

 InnoDB Storage Engine - Primary and Secondary Indexes

 Performance Tuning and Optimization

 Bulk Changes on Large Tables

 MySQL Server on macOS

Installing MySQL Server on Linux

 Install MySQL Database Server on CentOS

 Manage MySQL Server 'mysqld' on CentOS

 Set MySQL Server "root" Password on CentOS

 MySQL Server File Locations on CentOS

 MySQL Server Data Backups on CentOS

 MySQL Server Log Files on CentOS

"Multiple files found for the same tablespace ID" Error

 Connection, Performance and Second Instance on Linux

 Archived Tutorials

 References

 Full Version in PDF/EPUB