mysql遇见问题记录

mysql

问题记录:

service mysql start 显示错误信息:
140207 14:30:33 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140207 14:30:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140207 14:30:33 InnoDB: The InnoDB memory heap is disabled
140207 14:30:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140207 14:30:33 InnoDB: Compressed tables use zlib 1.2.3.4
140207 14:30:33 InnoDB: Initializing buffer pool, size = 128.0M
140207 14:30:33 InnoDB: Completed initialization of buffer pool
140207 14:30:33  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: 'open'.
InnoDB: Cannot continue operation.
  • 原因:

ubuntu下,mysql默认数据库存放路径是 /var/lib/mysql,由于管理员在 /etc/mysql/my.cnf 重定义了 datadir 但是 /data/mysql 没有设置正确的权限,重置 chown -R mysql:mysql /data/mysql 权限后,服务启动正常

  • 注意:
    如果更改了 /etc/mysql/my.cnf 的配置, /etc/apparmor.d/usr.sbin.mysqld 中也添加相应配置
#datadir        = /var/lib/mysql
datadir         = /data/mysql

/etc/apparmor.d/usr.sbin.mysqld

/var/log/mysql/ r,
/var/log/mysql/* rw,

你可能感兴趣的:(mysql遇见问题记录)