search

Home  >  Q&A  >  body text

"Cannot initialize when running mysql-server in Docker"

I am trying to initialize the mysql container in Docker by following the command:

docker run --name some-name -e MYSQL_ROOT_PASSWORD=my-password -e MYSQL_DATABASE=db-name mysql/mysql-server

It successfully pulls the container, and when it reaches this line, it stops there and never moves:

2022-02-28T09:10:03.040757Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: Prepare to connect. Version: "8.0.28" Socket: "/var/run/mysqld/mysqld.sock"�%A
P粉959676410P粉959676410307 days ago409

reply all(1)I'll reply

  • P粉810050669

    P粉8100506692024-03-27 15:37:10

    The solution I found was to add the following flag:

    -it and add /bin/bash

    at the end

    So the end of the final command looks like this:

    -it -d mysql:mysql-server /bin/bash

    This will run a terminal in the background of mysql and prevent it from closing. Just I'm hoping someone can correct me if this leads to any future errors, because a%E

    reply
    0
  • Cancelreply