使用docker log 容器id查看报错日志
Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
2020-08-24T07:46:16.964806Z 0 [ERROR] [MY-010095] [Server] 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
2020-08-24T07:46:16.968769Z 0 [ERROR] [MY-010119] [Server] Aborting
解决办法:
在启动容器时 需要加上
-v /home/mysql/mysql-files:/
var
/lib/mysql-files
例如我的:
docker run -p 3306:3306 --name mysql
-v /home/mysql/mysql-files:/var/lib/mysql-files
-v /mydata/mysql/log:/var/log/mysql
-v /mydata/mysql/data:/var/lib/mysql
-v /mydata/mysql/conf:/etc/mysql
-e MYSQL_ROOT_PASSWORD=123456
-d mysql:8.0.15