更改mysql目录后,Mysql将不再启动

时间:2015-07-16 16:35:18

标签: mysql linux sockets debian

我正在运行debian机器,我正在尝试移动我的mysql数据目录。在查看了一些在线教程后,看起来这样做的方法是更改​​my.cnf中的datadir。一些教程还谈到了更改一些apparmor文件,但看起来我没有安装apparmor。

在我更改了my.cnf后,我会继续在syslog中收到以下错误:

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时,我收到以下错误:

 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新文件目录。

1 个答案:

答案 0 :(得分:0)

所以看起来问题是在我正在更改数据的目录上运行chown -R。

无需更改套接字的位置。