首先在docker中安装mysql server的包:
sudo yum install mysql
sudo yum install mariadb-server mariadb
/usr/libexec/mysqld --port 10002 --datadir=/home/ahfuzhang/data --bind-address=192.168.0.8 --socket=/home/ahfuzhang/data
出现以下错误信息:
191101 18:05:37 [Note] Plugin 'FEEDBACK' is disabled.
191101 18:05:37 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
191101 18:05:37 [Note] Server socket created on IP: '192.168.0.8'.
191101 18:05:37 [ERROR] Can't start server : Bind on unix socket: Address already in use
191101 18:05:37 [ERROR] Do you already have another mysqld server running on socket: /home/ahfuzhang/data ?
191101 18:05:37 [ERROR] Aborting
才是是docker所在的母机上已经装了一个mysql,所以unix socket这里冲突了。
没有找到关闭unix socket的选项,暂未解决此问题。
mysqld的命令参数行文档在此:
https://mariadb.com/kb/en/library/mysqld-options/
=====================================
2019-11-02:
以上问题解决:
socket=/home/ahfuzhang/data/xxx.sock
这里必须是个文件名,而不是目录。
但是,后面又遇到一堆其他问题,仍然未解决。