2

I'm trying to run multiple instance of mysql 5.1.49 on ubuntu 10.10 to setup a replication/backup database. I have added following line to /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

also I have done:

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

but when I run:

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

as root or mysql user I get:

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.
...

and when I run mysqld_multi --verbose --no-log start 2 I get:

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.

Only mysql dir is create inside /var/lib/mysql2/.

Any idea?!

Thanks in advance.

4
  • You're replicating the MySQL database on the same machine? Why? (I ask not to be a jerk, but because there might be an alternative solution for your final goal) Jun 27, 2011 at 13:32
  • I'm trying to setup a backup strategy and I'm going to use the slave for backing up the master as described here, any idea is welcomed. Jun 27, 2011 at 14:44
  • that post recommends setting up a second MySQL Slave server - not another MySQL instance. If you lose the machine (networking issue, crashes, drives fail) than you have a second machine with the data replicated. This only saves you if your primary MySQL instance fails but the machine doesn't. Jun 27, 2011 at 16:59
  • @Marco Ceppi - You are right, I also copy bin-logs to Amazon S3, but I still need to be able to take hot-backups without interrupting master. Jun 29, 2011 at 7:22

1 Answer 1

2

Never mind, I found the answer here. The problem was with AppArmor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .