Mysql Can';t启动服务器:在unix套接字上绑定:不允许操作

Mysql Can';t启动服务器:在unix套接字上绑定:不允许操作,mysql,linux,docker,docker-for-windows,Mysql,Linux,Docker,Docker For Windows,环境: docker:docker版本17.12.0-ce,构建c97c6d6 视窗:视窗10 docker镜像:mysql/mysql服务器最新版本 我使用此命令成功创建容器,但几秒钟后自动停止: docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD="root" -e MYSQL_USER="sa" -e MYSQL_PASSWORD="123456" -v "/C/mysql/Config/my.cnf":/etc/my.cnf -v "/C/

环境: docker:docker版本17.12.0-ce,构建c97c6d6 视窗:视窗10 docker镜像:mysql/mysql服务器最新版本

我使用此命令成功创建容器,但几秒钟后自动停止:

docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD="root" -e MYSQL_USER="sa" -e MYSQL_PASSWORD="123456" -v "/C/mysql/Config/my.cnf":/etc/my.cnf -v "/C/mysql/Data":/var/lib/mysql --name server mysql/mysql-server
docker日志服务器:

Starting MySQL 5.7.21-1.1.3
2018-02-11T12:53:22.120561Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-11T12:53:22.125276Z 0 [Note] mysqld (mysqld 5.7.21) starting as process 1 ...
2018-02-11T12:53:22.139968Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-02-11T12:53:22.140147Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-02-11T12:53:22.140221Z 0 [Note] InnoDB: Uses event mutexes
2018-02-11T12:53:22.140282Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-02-11T12:53:22.140345Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-02-11T12:53:22.140404Z 0 [Note] InnoDB: Using Linux native AIO
2018-02-11T12:53:22.141479Z 0 [Note] InnoDB: Number of pools: 1
2018-02-11T12:53:22.144262Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-02-11T12:53:22.146215Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-02-11T12:53:22.154759Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-02-11T12:53:22.158172Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-02-11T12:53:22.212129Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-02-11T12:53:22.304744Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-02-11T12:53:22.304989Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-02-11T12:53:22.307389Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-02-11T12:53:22.469757Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-02-11T12:53:22.481187Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-02-11T12:53:22.481622Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-02-11T12:53:22.482185Z 0 [Note] InnoDB: Waiting for purge to start
2018-02-11T12:53:22.533061Z 0 [Note] InnoDB: 5.7.21 started; log sequence number 2552053
2018-02-11T12:53:22.533556Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-02-11T12:53:22.533812Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-02-11T12:53:22.591600Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180211 12:53:22
2018-02-11T12:53:22.600231Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-02-11T12:53:22.600407Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-02-11T12:53:22.606883Z 0 [Warning] CA certificate ca.pem is self signed.
2018-02-11T12:53:22.608530Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-02-11T12:53:22.611190Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-02-11T12:53:22.611373Z 0 [Note] IPv6 is available.
2018-02-11T12:53:22.611457Z 0 [Note]   - '::' resolves to '::';
2018-02-11T12:53:22.611539Z 0 [Note] Server socket created on IP: '::'.
2018-02-11T12:53:22.620768Z 0 [ERROR] Can't start server : Bind on unix socket: Operation not permitted
2018-02-11T12:53:22.620942Z 0 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
2018-02-11T12:53:22.621067Z 0 [ERROR] Aborting

2018-02-11T12:53:22.621204Z 0 [Note] Binlog end
2018-02-11T12:53:22.621421Z 0 [Note] Shutting down plugin 'ngram'
2018-02-11T12:53:22.621550Z 0 [Note] Shutting down plugin 'partition'
2018-02-11T12:53:22.621645Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-02-11T12:53:22.621744Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-02-11T12:53:22.621832Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-02-11T12:53:22.621993Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-02-11T12:53:22.622088Z 0 [Note] Shutting down plugin 'MyISAM'
2018-02-11T12:53:22.622199Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-02-11T12:53:22.622266Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-02-11T12:53:22.622314Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-02-11T12:53:22.622378Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-02-11T12:53:22.622426Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-02-11T12:53:22.622488Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-02-11T12:53:22.622536Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-02-11T12:53:22.622599Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-02-11T12:53:22.622647Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-02-11T12:53:22.622724Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-02-11T12:53:22.622773Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-02-11T12:53:22.622837Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-02-11T12:53:22.622885Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-02-11T12:53:22.622947Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-02-11T12:53:22.623031Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-02-11T12:53:22.623087Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-02-11T12:53:22.623143Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-02-11T12:53:22.623197Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-02-11T12:53:22.623254Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-02-11T12:53:22.623308Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-02-11T12:53:22.623363Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-02-11T12:53:22.623418Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-02-11T12:53:22.623474Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-02-11T12:53:22.623528Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-02-11T12:53:22.623648Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-02-11T12:53:22.623753Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-02-11T12:53:22.623845Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-02-11T12:53:22.623953Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-02-11T12:53:22.624004Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-02-11T12:53:22.624068Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-02-11T12:53:22.624116Z 0 [Note] Shutting down plugin 'InnoDB'
2018-02-11T12:53:22.624273Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-02-11T12:53:22.624454Z 0 [Note] InnoDB: Starting shutdown...
2018-02-11T12:53:22.724955Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-02-11T12:53:22.739902Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180211 12:53:22
2018-02-11T12:53:24.348445Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2552072
2018-02-11T12:53:24.352699Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-02-11T12:53:24.353012Z 0 [Note] Shutting down plugin 'MEMORY'
2018-02-11T12:53:24.353110Z 0 [Note] Shutting down plugin 'CSV'
2018-02-11T12:53:24.353214Z 0 [Note] Shutting down plugin 'sha256_password'
2018-02-11T12:53:24.353308Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-02-11T12:53:24.353542Z 0 [Note] Shutting down plugin 'binlog'
2018-02-11T12:53:24.357751Z 0 [Note] mysqld: Shutdown complete
我已经为每个人设置了dir“C:/mysql/”权限,我该怎么办?还是忘了什么?

感谢Ahab的帮助,当我添加标签“:rw” 还是一样的结果 无法在unix套接字上启动服务器:绑定:不允许操作

根据:

引述:


如果要在容器的MySQL数据目录上绑定挂载(有关详细信息,请参阅持久化数据和配置更改),则必须使用--socket选项将服务器套接字文件的位置设置为MySQL数据目录之外的某个位置;否则,服务器将无法启动。这是因为Docker for Windows处理文件装载的方式不允许在套接字文件上绑定装载主机文件

我不得不在win 10上使用docker卷来解决这个问题,下面给出了撰写文件

version: '3' services: webapp: build: context: . dockerfile: Dockerfile-webapp image: webapp privileged: true volumes: - ./app:/var/www/html/app - ./httpd.conf:/etc/httpd/conf/httpd.conf ports: - "8080:80" environment: - dockerenv=true links: - dbserver:dbserver dbserver: image: percona:5.6.41 restart: always environment: MYSQL_ROOT_PASSWORD: ports: - "3306:3306" volumes: - dockerdbdata:/var/lib/mysql - ./query/init.sql:/docker-entrypoint-initdb.d/init.sql privileged: true volumes: dockerdbdata: 版本:“3” 服务: 网络应用程序: 建造: 上下文:。 dockerfile:dockerfile webapp 图片:webapp 特权:真的 卷数: -./app:/var/www/html/app -/httpd.conf:/etc/httpd/conf/httpd.conf 端口: - "8080:80" 环境: -dockerenv=true 链接: -dbserver:dbserver 数据库服务器: 图片:percona:5.6.41 重新启动:始终 环境: MYSQL\u ROOT\u密码: 端口: - "3306:3306" 卷数: -dockerdbdata:/var/lib/mysql -./query/init.sql:/docker-entrypoint-initdb.d/init.sql 特权:真的 卷数: dockerdbdata:
>您是否已经有另一台mysqld服务器在socket上运行:/var/lib/mysql/mysql.sock?@BMitch是的,但我已经停止了mysqld服务卷将是您的问题,不确定这是Windows与socket不兼容还是权限错误:
-v”/C/mysql/Data:/var/lib/mysql
正常跟随者:docker run-d-p 3306:3306-e mysql\u ROOT\u PASSWORD=“ROOT”-e mysql\u USER=“sa”-e mysql\u PASSWORD=“123456”-v“C:/mysql/Config/my.cnf”:/etc/my.cnf--命名服务器mysql/mysql服务器,但添加不工作的卷