Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql tables missing after Docker update: "TableName doesn't exist in engine"

A recent Docker update seems to have caused (just some) InnoDB tables in a MariaDB to not be accessible. I get:

#1932 - Table 'dbname.SomeTableName' doesn't exist in engine

when trying to access them (they do SHOW up in a table list). I've updated Docker (and the image) in the past with no problem. The db files and permissions look fine.

I could recreate just the "missing" tables (4 out of ~35) from a backup, but when I try to delete them I get:

#1347 - 'dbname.SomeTableName' is not VIEW

I'm using Docker image mariadb:10.2 (MariaDB-10.2.12+maria~jessie) with a bind-mount for persistent data storage as part of a local Docker-for-Mac dev environment. The docker-compose.yml file looks like:

mysql: image: mariadb:10.2 volumes: - ./data/mysql:/var/lib/mysql

I've never had this error before and cannot dump or export the unaccessible tables. Is there a way to restore or repair (or delete) them? I would rather not have to recreate the entire database.

like image 827
ldg Avatar asked Mar 01 '18 02:03

ldg


People also ask

Where is Docker MySQL data stored?

Using this command to start your MySQL container will create a new Docker volume called mysql . It'll be mounted into the container at /var/lib/mysql , where MySQL stores its data files. Any data written to this directory will now be transparently stored in the Docker-managed volume on your host.


Video Answer


1 Answers

I was able to solve this by using a custom mysql config for my local and adding:

[mysqld]
lower_case_table_names=1

You can do this without changing your default config by mounting a file containing the text above into the mysql conf.d directory like:

volumes:
  - ./mysql_local.cnf:/etc/mysql/conf.d/mysql_local.cnf:ro
like image 133
ldg Avatar answered Oct 23 '22 22:10

ldg