简体   繁体   English

如何解决 --initialize 指定但数据目录中有文件。 在 laradock mysql 容器上

[英]How to resolve --initialize specified but the data directory has files in it. on laradock mysql container

I'm using laradock.我正在使用 laradock。 when I use docker-compose up mysql I got this error.当我使用docker-compose up mysql出现此错误。

mysql_1                | Initializing database
mysql_1                | 2018-04-22T10:41:01.362165Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
mysql_1                | 2018-04-22T10:41:01.362585Z 0 [ERROR] Aborting
mysql_1                |
laradock_mysql_1 exited with code 1

I tried to add this setting on laradock/mysql/Dockerfile like this我试图像这样在 laradock/mysql/Dockerfile 上添加这个设置

ARG MYSQL_VERSION=latest
FROM mysql:${MYSQL_VERSION}

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

#####################################
# Set Timezone
#####################################

ARG TZ=UTC
ENV TZ ${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN chown -R mysql:root /var/lib/mysql/

COPY my.cnf /etc/mysql/conf.d/my.cnf

CMD ["mysqld --ignore-db-dir=lost+found"]

EXPOSE 3306

but, I'm still getting above error.但是,我仍然遇到上述错误。 Do you have any idea on this solution?你对这个解决方案有什么想法吗?

Thanks,谢谢,

I had a similar issue.我有一个类似的问题。 In order to solve it, you have to为了解决它,你必须

  1. go to C:\\Program Files\\MySQL\\MySQL Server 5.7转到C:\\Program Files\\MySQL\\MySQL Server 5.7
  2. you will find a folder named data .你会找到一个名为data的文件夹。 rename it into data1 .将其重命名为data1
  3. launch command prompt as an administrator.以管理员身份启动命令提示符。
  4. execute mysqld --initialize-insecure .执行mysqld --initialize-insecure
  5. go to the services in the control panel, stop all services related to MySql such as MySQL57 .转到控制面板中的服务,停止所有与 MySql 相关的服务,例如MySQL57
  6. Start MySQL启动MySQL

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose 卷问题和错误 -- 指定了初始化,但数据目录中有文件。 中止 - docker-compose volume question and error --initialize specified but the data directory has files in it. Aborting 无法部署 MySQL pod。 --initialize 指定但数据目录中有文件 - Cannot deploy MySQL pod. --initialize specified but the data directory has files in it mysql 5.7数据目录中有文件 - mysql 5.7 data directory has files in it 在Docker容器中初始化MySQL数据 - Initialize MySQL data in Docker Container 如何在docker容器中迁移MySQL数据目录? - How to migrate MySQL data directory in docker container? 无法通过phpmyadmin连接到laradock mysql容器 - cannot connect to laradock mysql container via phpmyadmin 指定的数据目录 /var/lib/mysql/ 不可用。 您可以删除服务器添加到其中的所有文件。 mysql图像中的错误 - The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it. error in mysql image Laradock MySQL 容器退出(0) - 服务器(&#39;2&#39;)和数据字典(&#39;0&#39;)的不同lower_case_table_names设置 - Laradock MySQL container exits(0) - Different lower_case_table_names settings for server ('2') and data dictionary ('0') Mysql - 如何从数据库(mysql)中检索数据并打印它。(php) - Mysql - how to retrieve data from a database(mysql) and print it.(php) 在 Kubernetes 上创建时如何初始化 mysql 容器? - How to initialize mysql container when created on Kubernetes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM