运行多个 MySQL 实例时出现问题

运行多个 MySQL 实例时出现问题

我正在尝试在 ubuntu 10.10 上运行多个 mysql 5.1.49 实例来设置复制/备份数据库。我已将以下行添加到/etc/mysql/my.cnf

[mysqld2]
server-id  = 2
socket     = /tmp/mysql2.sock
port       = 3308
pid-file   = /var/lib/mysql2/mysql2.pid
datadir    = /var/lib/mysql2
log-error  = /var/log/mysqld2/mysql2.log
user       = mysql

我还做了:

mkdir /var/lib/mysql2
chmod -R 777 /var/lib/mysql2
chown -R mysql:mysql /var/lib/mysql2

但是当我跑步时:

/usr/bin/mysql_install_db --datadir=/var/lib/mysql2 [--user=mysql]

作为 root 或 mysql 用户我得到:

110627 17:04:17 [Warning] Can't create test file /var/lib/mysql2/david.lower-test
110627 17:04:17 [Warning] Can't create test file /var/lib/mysql2/david.lower-test

Installation of system tables failed!  Examine the logs in
/var/lib/mysql2 for more information.
...

当我跑步时mysqld_multi --verbose --no-log start 2我得到:

110627 17:07:21 [Warning] Can't create test file /var/lib/mysql2/david.lower-test
110627 17:07:21 [Warning] Can't create test file /var/lib/mysql2/david.lower-test
110627 17:07:21 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
110627 17:07:21 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110627 17:07:21  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

mysql在内部创建目录/var/lib/mysql2/

任何想法?!

提前致谢。

答案1

没关系,我找到答案了这里。问题出在 AppArmor 上。

相关内容