I wanted to have my mysql config in svn to be versionised so i did thefollowing:
ubuntu@ip-10-226-50-211:~/mysql-config$ ls -la /etc/mysql/conf.d/
total 12
drwxr-xr-x 2 root root 4096 2011-01-27 11:45 .
drwxr-xr-x 3 root root 4096 2011-01-27 11:42 ..
lrwxrwxrwx 1 root root 37 2011-01-27 11:45 flimmit.cnf -> /home/ubuntu/mysql-config/flimmit.cnf
A link in conf.d folder points to my local config.
The global mysql config is untouched, i installed a fresh release of ubuntu lucid LTS.
flimmit.cnf looks like this:
[mysqld]
bind-address = 0.0.0.0
max_connections = 600
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = flimmit_shop_14
binlog_do_db = flimmit_search_14
datadir = /media/mysql-ebs/datadir
The chmod of this config is 644
So i stopped mysql, activated the config, moved all contents of /var/lib/mysql to the new location /media/mysql-ebs/datadir
same for the log, but there wasnt any yet.
i chowned the whole /media/mysql-ebs folder to mysql.mysql (recursively)
the contents of the data dir are
debian-5.1.flag ibdata1 ib_logfile0 ib_logfile1 mysql mysql_upgrade_info
problem is now that the sudo start mysql
seems to hang
my mysql error.log states:
110127 11:57:58 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Some place i read something about not copying ib_arch_log_0000000000, ib_logfile0
.
So what files to copy? What not? And Why?
Ps:
I tried it also with moving only the mysql folder (mysql database) and nothing else. same thing. I also read something about modifying the init script, but theres no such thing in my init script and i would really find it stupid if the datadir would have to be defined in the init script and the config file.
Pps:
after a while i saw that apparmor was running, so i adjusted the rules accordingly:
#/var/lib/mysql/ r,
#/var/lib/mysql/** rwk,
/media/mysql-ebs/datadir/ r,
/media/mysql-ebs/datadir/** rwk,
for now i discarded the changement of the log dir and focused only on the data dir. but somehow this didnt change anything. of course i restarted apparmor.
Ppps:
i confirmed the problem IS appaormor. after running /etc/init.d/apparmor teardown
everything worked fine. But what is wrong with the config? I will post it as a whole:
# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>
/usr/sbin/mysqld {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/user-tmp>
#include <abstractions/mysql>
#include <abstractions/winbind>
capability dac_override,
capability sys_resource,
capability setgid,
capability setuid,
network tcp,
/etc/hosts.allow r,
/etc/hosts.deny r,
/etc/mysql/*.pem r,
/etc/mysql/conf.d/ r,
/etc/mysql/conf.d/* r,
/etc/mysql/my.cnf r,
/usr/sbin/mysqld mr,
/usr/share/mysql/** r,
/var/log/mysql.log rw,
/var/log/mysql.err rw,
#/var/lib/mysql/ r,
#/var/lib/mysql/** rwk,
/media/mysql-ebs/datadir/ r,
/media/mysql-ebs/datadir/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/var/run/mysqld/mysqld.pid w,
/var/run/mysqld/mysqld.sock w,
/sys/devices/system/cpu/ r,
}
Best Answer
are you sure that mysql user has access to /home/ubuntu/ directory?