Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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) –  Marco Ceppi Jun 27 '11 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. –  JohnS Jun 27 '11 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. –  Marco Ceppi Jun 27 '11 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. –  JohnS Jun 29 '11 at 7:22
add comment

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.