/var/lib/mysql is unusable error in kubernetes mysql deployment

r1zk6ea1  于 2022-12-22  发布在  Mysql
关注(0)|答案(1)|浏览(408)

I am trying to create mysql container in kubernetes at mount path /var/lib/mysql but when I do deployment I am getting below error.

2022-12-16T07:13:59.139528Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-12-16T07:13:59.139537Z 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.

How can I fix this error. I want to create MySql container and store the database in some folder so that on new deployement I am able to get that old data.

olhwl3o2

olhwl3o21#

2022-12-16T07:13:59.139528Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
Your directory is not empty. You have to remove all the contents of it or choose another one.
The error message "Newly created data directory /var/lib/mysql/ is unusable" comes up because of a size issue. Check/increase the underlying server size or the docker allocated size for the system.
You can also create a docker container from the command line to fill an empty data directory by MySQL initialization and after that use docker-compose. When the data directory is already initialized no errors appear.
Also check GitHub link and Stackpost .

相关问题