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

标签 mysql linux sockets debian

我正在运行 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将不再启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31459845/

相关文章:

linux - 加州大学戴维斯分校 SNMP mib 求和 ssCPU* 导致重叠

Java套接字从客户端向服务器发送数据

actionscript-3 - 在 ActionScript 3下禁用Nagle的算法

mysql - 选择mysql中所有带有ascii代码的列

php - 允许用户在 PHP 中投票一次

linux - 替换文本中的一个数字并用新值克隆它

linux - nasm 上的 execvp 用法

c - 为什么客户端调用shutdown(sockfd, SHUT_RD)后,客户端程序中的recv()可以接收到发送给客户端的消息?

mysql - mysql中的初始授权问题

mysql - #1064 - 你的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解使用“near”的正确语法