-2

As you can see in the picture, when I use select * from users, it tells me table doesn't exist. However, we can see the table exists by the show tables command.

Besides, I can see the .ibd and .frm file exists in the mysql data dictionary. This happens after we restarted the server, we use docker swarm to deploy our services and nas to mount the data

services: mysql: image: dockerhub.datagrand.com/idps/mysql:patest restart: always volumes: - ./data/mysql/data:/var/lib/mysql 

After we restart our server, we use mount -t command to remount the data. Anyone knows I can resolve this?

enter image description here

2
  • 1
    Did you try googling that error? Check this possibly duplicate question. The talk about files and Docker suggest the files aren't consistent - perhaps some were aren't visible by the container. Perhaps the data files are there but not the configuration files Commented Sep 10 at 12:57
  • Are there permission issues? Commented Sep 11 at 4:16

1 Answer 1

1

This is a very smoke-and-mirrors problem I have seen over the years.

Here is the inside story on why this is happening:

When you do SHOW TABLES;, mysqld will scan for .frm files only to present table names. It will not need to reach for any metadata about the table at the storage engine layer.

The moment you request anything requiring access to the table's storage layer (touching info inside .ibd) this is where the problem starts.

In the eyes of the the InnoDB Storage Engine, the system tablespace cannot see the table. In this respect, it is broken.

As an example, run this query

SELECT COUNT(1) rowcount FROM information_schema.tables WHERE table_schema ='dg_oauth' AND table_name='users'; 

This query will return 1.

If you run this next one

SELECT COUNT(1) rowcount FROM information_schema.tables WHERE table_schema ='dg_oauth' AND table_name='users' AND data_length > 1; 

This may return an error. In that case, the table technically no longer exists.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.