【发布时间】:2015-07-16 16:35:18
【问题描述】:
我正在运行一个 debian 机器,我正在尝试移动我的 mysql 数据目录。在看了一些在线教程之后,看起来这样做的方法是更改 my.cnf 中的 datadir。有些教程还谈到了更改一些 apparmor 文件,但看起来我没有安装 apparmor。
更改 my.cnf 后,系统日志中会不断出现以下错误:
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jul 16 16:21:04 sparta /etc/init.d/mysql[29315]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
再环顾四周后,我发现了一个网站,该网站说我还应该更改套接字的目录。所以我这样做了,但我仍然遇到同样的问题。
当我运行sudo mysqld start 时出现以下错误:
150716 16:25:54 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150716 16:25:54 [Note] mysqld (mysqld 5.5.43-0+deb7u1) starting as process 29416 ...
150716 16:25:54 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
150716 16:25:54 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
150716 16:25:54 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150716 16:25:54 InnoDB: The InnoDB memory heap is disabled
150716 16:25:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150716 16:25:54 InnoDB: Compressed tables use zlib 1.2.7
150716 16:25:54 InnoDB: Using Linux native AIO
150716 16:25:54 InnoDB: Initializing buffer pool, size = 128.0M
150716 16:25:54 InnoDB: Completed initialization of buffer pool
150716 16:25:54 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.
这是我编辑的 my.cnf 文件部分的副本:
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /mysql_persistant/
port = 3306
basedir = /usr
datadir = /mysql_persistant/
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
我还有 chmod 755 新文件目录。
【问题讨论】:
-
chown -R mysql:mysql 在你的 mysql 数据目录上吗?
-
我运行了它,现在 sudo mysqld 给了我一个不同的错误。我现在要更新我的问题。
标签: mysql linux sockets debian