获取错误容器id
docker ps -a
查看日志
docker logs 错误容器id
Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/ lib/mysql-files
这条错误是指宿主机没有挂载mysql-files这个目录,创建容器的时候需要挂载上
示例
-v /root/mysql/mysql-files:/var/lib/mysql-files/
开启log-bin时You have enabled the binary log, but you haven t provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
这个错误是在设置bin log日志的时候,没有设置server_id参数。server-id参数用于在复制中,为主库和备库提供一个独立的ID,以区分主库和备库;开启二进制文件的时候,需要设置这个参数。
可以将my.cnf移动到容器挂载目录上
mv my.cnf conf.d/
进入主机挂载目录修改
vi my.cnf 加上server-id=1 重新启动容器即可



