我正在尝试在当前计算机上配置另一个 mysql 实例,但我无法
mysql_install_db --user=mysql --datadir=/var/lib/mysql2
Installing MySQL system tables...
ERROR: 1005 Can't create table 'db' (errno: 13)
121118 15:25:12 [ERROR] Aborting
121118 15:25:12 [Note] /usr/sbin/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/var/lib/mysql2/ for more information.
You can try to start the mysqld daemon with:
shell> /usr/sbin/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql2/ that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/scripts/mysqlbug script!
系统日志::
kernel: [ 6723.794523] type=1400 audit(1353231920.455:324): apparmor="DENIED" operation="mknod" parent=6840 profile="/usr/sbin/mysqld" name="/var/lib/mysql2/mysql/db.frm" pid=6879 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=115 ouid=115
以下是配置:
# 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/*.cnf r,
/usr/lib/mysql/plugin/ r,
/usr/lib/mysql/plugin/*.so* mr,
/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,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/var/run/mysqld/mysqld.pid w,
/var/run/mysqld/mysqld.sock w,
/run/mysqld/mysqld.pid w,
/run/mysqld/mysqld.sock w,
/var/log/mysql2.log rw,
/var/log/mysql2.err rw,
/var/lib/mysql2/ r,
/var/lib/mysql2/* rw,
/var/run/mysqld/mysqld2.pid w,
/var/run/mysqld/mysqld2.sock w,
/run/mysqld/mysqld2.pid w,
/run/mysqld/mysqld2.sock w,
/sys/devices/system/cpu/ r,
# Site-specific additions and overrides. See local/README for details.
#include <local/usr.sbin.mysqld>
}