简体   繁体   中英

The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it. error in mysql image

after I changed data directory of docker (ie /etc/docker/daemon.json), I get the following error while I'm trying to run mysql image

    2022-07-13T10:31:27.580551Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 43
2022-07-13T10:31:27.584905Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-07-13T10:31:27.588941Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file inside "/tmp"; errno: 13
2022-07-13T10:31:27.588965Z 1 [ERROR] [MY-012929] [InnoDB] InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2022-07-13T10:31:27.589074Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-07-13T10:31:27.589091Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-07-13T10:31:27.589141Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-07-13T10:31:27.589437Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Server - GPL.

The "real" problem is shown earlier in this line:

2022-07-13T10:31:27.588941Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file inside "/tmp"; errno: 13

MySQL seems to have problems writing your /tmp directory. Please check the permissions for the directory and/or the docker configuration.

After this is fixed you can remove the mentioned data directory ( /var/lib/mysql ) and try again. But please be careful if you had any existing databases in the directory before ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM