昨天在用docker部署mysql的時(shí)候一直報(bào)錯(cuò)
2020-06-23T09:59:47.339758Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-06-23T09:59:47.340593Z 0 [Warning] CA certificate ca.pem is self signed.
2020-06-23T09:59:47.340636Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-06-23T09:59:47.340852Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2020-06-23T09:59:47.340867Z 0 [ERROR] Unable to setup unix socket lock file.
2020-06-23T09:59:47.340872Z 0 [ERROR] Aborting
解決方法:
這里可以看到mysqld.sock的目錄是在/var/run/mysqld目錄下专缠,但是這個(gè)目錄,我們并沒有掛載主機(jī)目錄吴旋,下面我們重新運(yùn)行mysql容器矾策,掛載相應(yīng)的容器
volumes:
- /data/mysql-data:/var/lib/mysql
- ./init:/docker-entrypoint-initdb.d/
- /data/mysql-data/mysqld:/var/run/mysqld
參考:
docker安裝mysql及相關(guān)配置宛乃、運(yùn)行細(xì)節(jié)和常見報(bào)錯(cuò)解決方案