Home  >  Q&A  >  body text

Kubernetes MySQL deployment encounters /var/lib/mysql unavailable error

I am trying to create mysql container at mount path /var/lib/mysql in kubernetes, but when I deploy, I get the following error.

2022-12-16T07:13:59.139528Z 0 [Error] [MY-010457] [Server] --initialize was specified but there were files in the data directory. Aborting.

2022-12-16T07:13:59.139537Z 0 [Error] [MY-013236] [Server] The specified data directory /var/lib/mysql/ is not available. You can delete all files added to it by the server.

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

P粉949848849P粉949848849285 days ago446

reply all(1)I'll reply

  • P粉788765679

    P粉7887656792024-01-09 12:10:37

    Your directory is not empty. You must delete everything there or choose something else.

    The error message "The newly created data directory /var/lib/mysql/ is not available" appears due to size issues. Check/increase the underlying server size or the docker size allocated for the system.

    You can also create a docker container from the command line, populate the empty data directory with MySQL initialization, and then use docker-compose. When the data directory has been initialized, no error occurs.

    Also check out the GitHub link and Stackpost.

    reply
    0
  • Cancelreply