我是mysql的新手。今天我尝试在Ubuntu 16上使用mysql 5.7.13运行mysqld_multi的多个mysql实例。
我的问题是当我执行cmd“mysqld_multi start --no-log”时,实例未运行。根据syslog中的错误日志,我不知道错误是什么。
这是输出:
root@ubuntu:/var/run/mysqld# mysqld_multi start --no-log
mysqld_multi log file version 2.16; run: Wed Aug 24 05:07:23 2016
Starting MySQL servers
root@ubuntu:/var/run/mysqld# 2016-08-24T12:07:25.411476Z mysqld_safe Logging to syslog.
2016-08-24T12:07:25.413934Z mysqld_safe Logging to syslog.
2016-08-24T12:07:25.457022Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2016-08-24T12:07:25.464033Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2016-08-24T12:07:25.708791Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql1
2016-08-24T12:07:25.707895Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql7
2016-08-24T12:07:27.349043Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld7.pid ended
2016-08-24T12:07:27.360686Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld1.pid ended
Mysql服务器未运行:
root@ubuntu:/var/run/mysqld# mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld7 is not running
这是syslog中的日志:
root@ubuntu:/var/run/mysqld# tail -50 /var/log/syslog
Aug 24 05:07:25 ubuntu mysqld_safe: Logging to '/var/log/mysql/error.log'.
Aug 24 05:07:25 ubuntu mysqld_safe: Logging to '/var/log/mysql/error.log'.
Aug 24 05:07:25 ubuntu mysqld_safe: Starting mysqld daemon with databases from /data/mysql/mysql1
Aug 24 05:07:25 ubuntu mysqld_safe: Starting mysqld daemon with databases from /data/mysql/mysql7
Aug 24 05:07:27 ubuntu mysqld[33826]: /usr/sbin/mysqld (mysqld 5.7.13-0ubuntu0.16.04.2) starting as process 33826 ...
Aug 24 05:07:27 ubuntu mysqld[33825]: /usr/sbin/mysqld (mysqld 5.7.13-0ubuntu0.16.04.2) starting as process 33825 ...
Aug 24 05:07:27 ubuntu mysqld[33826]: Aborting
Aug 24 05:07:27 ubuntu mysqld[33826]: Binlog end
Aug 24 05:07:27 ubuntu mysqld[33826]: /usr/sbin/mysqld: Shutdown complete
Aug 24 05:07:27 ubuntu mysqld[33825]: Aborting
Aug 24 05:07:27 ubuntu mysqld[33825]: Binlog end
Aug 24 05:07:27 ubuntu mysqld[33825]: /usr/sbin/mysqld: Shutdown complete
Aug 24 05:07:27 ubuntu mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld7.pid ended
Aug 24 05:07:27 ubuntu mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld1.pid ended
以下是/etc/my.cnf的内容
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = multi_admin
password = multipass
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
[mysqld1]
user = mysql
pid-file = /var/run/mysqld/mysqld1.pid
socket = /var/run/mysqld/mysqld1.sock
port = 3307
datadir = /data/mysql/mysql1
basedir = /usr
[mysqld7]
user = mysql
pid-file = /var/run/mysqld/mysqld7.pid
socket = /var/run/mysqld/mysqld7.sock
port = 3308
datadir = /data/mysql/mysql7
basedir = /usr
我认为许可很顺利:
root@ubuntu:/data/mysql# ll
total 16
drwxrwxrwx 4 mysql mysql 4096 Aug 24 01:06 ./
drwxrwxrwx 3 mysql mysql 4096 Aug 23 23:48 ../
drwxr-xr-x 5 mysql mysql 4096 Aug 24 05:07 mysql1/
drwxr-xr-x 5 mysql mysql 4096 Aug 24 05:07 mysql7/
/etc/apparmor.d/usr.sbin.mysqld中的权限也被修改:
/var/run/mysqld/mysqld1.pid rw,
/var/run/mysqld/mysqld1.sock w,
/var/lib/mysql1/ r,
/var/lib/mysql1/** rwk,
/var/log/mysql1/ r,
/var/log/mysql1/* rw,
/var/log/mysql1.log rw,
/var/log/mysql1.err rw,
/run/mysqld/mysqld1.pid rw,
/run/mysqld/mysqld1.sock w,
/data/mysql/mysql1/** rwk,
/data/mysql/mysql1/ r,
/var/run/mysqld/mysqld7.pid rw,
/var/run/mysqld/mysqld7.sock w,
/var/lib/mysql7/ r,
/var/lib/mysql7/** rwk,
/var/log/mysql7/ r,
/var/log/mysql7/* rw,
/var/log/mysql7.log rw,
/var/log/mysql7.err rw,
/run/mysqld/mysqld7.pid rw,
/run/mysqld/mysqld7.sock w,
/data/mysql/mysql7/** rwk,
/data/mysql/mysql7/ r,
为什么不能开始实例?