在windows 中 docker 中遇到的mysql World-writable config file ‘/etc/mysql/my.cnf‘ is ignored.

[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

网上说是MySQL的升级后的安全原因5.xx之后吧,那么你可以降级处理(ps.没操作过)
我的操作方式是直接新建一个目录挂在到/var/lib/mysql-files

user=mysql
character-set-server=utf8
default_authentication_plugin=mysql_native_password
secure_file_priv=/var/lib/mysql
# secure-file-priv=/var/lib/mysql (和上面哪个一样哪个能用用哪个)
expire_logs_days=7
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
max_connections=1000

我的命令

docker run -d --privileged=true -p  13306:3306 --name qqqmysql -v D:\sqldata:/var/lib/mysql -v D:\sqlinfo\conf.d:/etc/mysql/conf.d -v D:\sqlinfo\my.cnf:/etc/mysql/my.cnf -v D:\sqlinfo\mysql-files:/var/lib/mysql-files -e MYSQL_RANDOM_ROOT_PASSWORD=root -e MYSQL_ROOT_PASSWORD=root -e MYSQL_ALLOW_EMPTY_PASSWORD=root mysql:latest

另外-最好是空文件夹挂载

Usage against an existing database
If you start your mysql container instance with a data directory that already contains a database (specifically, a mysql subdirectory), the $MYSQL_ROOT_PASSWORD variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way.

参考的一些文章

(https://help.aliyun.com/noticelist/articleid/8504221.html)

  • 使用Docker安装mysql,挂载外部配置和数据
  • 云服务器 ECS Ubuntu 系统修改 DNS 配置文件 i 属性报错:Operation not supported while reading flags
  • 【Docker】创建mysql容器、挂载目录、Navicat客户端连接
  • mysql配置挂载到卷
  • Linux文件权限修改

你可能感兴趣的:(mysql,windows,docker)