In OS X.
I am trying to start mysql in a docker container via boot2docker by setting the volume /var/lib/mysql on the host so that I have persistent mysql data. I plan to use the data container only in the future, but right now I was trying to do this using this option.
I use the following command to start the container:
docker run -v /Users/yash/summers/db:/var/lib/mysql -i -t 'image name'
The folder /Users/yash/summers/db already exists.
In this, I ran into problems with the press. Using the command line, I can access the directory, create / delete new files, but when I start the service mysql start , I get the following error:
150528 15:43:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150528 15:43:43 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150528 15:43:43 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 909 ... 150528 15:43:43 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive 150528 15:43:43 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.150528 15:43:43 [Note] Plugin 'FEDERATED' is disabled. /usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 150528 15:43:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 150528 15:43:43 InnoDB: The InnoDB memory heap is disabled 150528 15:43:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins 150528 15:43:43 InnoDB: Compressed tables use zlib 1.2.8 150528 15:43:43 InnoDB: Using Linux native AIO 150528 15:43:43 InnoDB: Initializing buffer pool, size = 128.0M 150528 15:43:43 InnoDB: Completed initialization of buffer pool 150528 15:43:43 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'create'. InnoDB: Cannot continue operation. 150528 15:43:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
I have been trying to solve this in the last 2 days by going through as many pages as this , this and this .
I can not solve my problem. I think that I am not able to do what the proposed solutions offer.
From my point of view, there are some workarounds listed on these pages that include modifying uids and guids, but I think they are not entirely clear.
Can someone please explain me a detailed workaround for this.
Update 1: I tried it using a data-only container and still ran into the same problem.
I can start everything fine if I do not use the -v or --volumes-from , so I think there are no problems on the mysql server.
Update 2: Dockerfile used to create a data-only container:
FROM ubuntu RUN mkdir /var/lib/mysql VOLUME /var/lib/mysql