Use dockerfile/mysql mysqld_safe mysqld from pid file error

The following docker run command results in an unexpected error.

docker run --name mysql -d -v /data/mysql:/var/lib/mysql dockerfile/mysql

Error: 150311 07:36:04 mysqld_safe Starting mysqld daemon with
databases from /var/lib/mysql 150311 07:36:04 mysqld_safe mysqld from
pid file /var/run/mysqld/ ended

  • Connect to a Service running inside a docker container from outside
  • Error response from daemon: network myapp not found
  • Sending data from one pod to another pod running specifically on the same host (DaemonSet)
  • Connect docker container to both internet and VPN
  • How can I force cancel dockerbuild using bash a command?
  • Docker Hub - Automated build linked to Bitbucket
  • How can I solve it?

  • How to run a docker container which acts as a proxy/gateway?
  • How can I get an upstart script to properly manage running a docker image?
  • dante-sever fail to bind ip by interface name in docker container
  • Cannot start docker after installation on Windows
  • Cross-region load balancing + routing on Google Container Engine
  • Sensu /checks API call appears empty
  • 2 Solutions collect form web for “Use dockerfile/mysql mysqld_safe mysqld from pid file error”

    If it is not for the production environment and is for local testing only then the simplest way to make it run is

    sudo chmod -R 777 /data/mysql

    This command is basically giving read and write permissions to all users for mysql folder.

    Please let us know if this worked for you.

    The permissions are wrong on the /data/mysql folder, so the mysql user in the container is unable to write to the directory. To fix this, you can either find the uid of the mysql user in the container and give it permissions to access the directory, or use a data container.

    To find the uid, run:

    docker run dockerfile/mysql id -u mysql

    Then you can do something like sudo chown ID /data/mysql (where id is the UID) to give access to the mysql user.

    To set up a data container see the official docs.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.