从昨天开始,当连接到mysql时,我会收到这个错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)我已经一个月没有动过我的安装程序了,所以我不相信它是由我试图对设置所做的任何更改所驱动的。当我尝试重新启动mysql服务时
service mysqld restart我知道这个错误:
Stopping mysqld: [ OK ]
touch: cannot touch ‘/var/log/mysqld.log’: Permission denied
chown: changing ownership of ‘/var/log/mysqld.log’: Operation not permitted
chmod: changing permissions of ‘/var/log/mysqld.log’: Operation not permitted
chown: changing ownership of ‘/var/lib/mysql’: Operation not permitted
chmod: changing permissions of ‘/var/lib/mysql’: Operation not permitted
MySQL Daemon failed to start.如果我试着:
sudo service mysqld restart我只得到:
Stopping mysqld: [ OK ]
MySQL Daemon failed to start.
Starting mysqld: [FAILED]我认为这是基于我在其他服务器错误线程上看到的关于相同错误的权限问题,但我仍然感到困惑,因为我应该有在该目录中执行文件的权限:
drwxr-xr-x 6 mysql mysql 4096 Jun 21 16:42 /var/lib/mysql更新:下面的日志。看起来像是内存问题,但我不知道如何解决:
140618 20:17:46 mysqld_safe Number of processes running now: 0
140618 20:17:46 mysqld_safe mysqld restarted
140618 20:17:47 [Note] Plugin 'FEDERATED' is disabled.
140618 20:17:47 InnoDB: The InnoDB memory heap is disabled
140618 20:17:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140618 20:17:47 InnoDB: Compressed tables use zlib 1.2.7
140618 20:17:47 InnoDB: Using Linux native AIO
140618 20:17:47 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140618 20:17:47 InnoDB: Completed initialization of buffer pool
140618 20:17:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140618 20:17:47 [ERROR] Plugin 'InnoDB' init function returned error.
140618 20:17:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140618 20:17:47 [ERROR] Unknown/unsupported storage engine: InnoDB
140618 20:17:47 [ERROR] Aborting
140618 20:17:47 [Note] /usr/libexec/mysqld: Shutdown complete
140618 20:17:47 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140621 16:42:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140621 16:42:49 [Note] Plugin 'FEDERATED' is disabled.
140621 16:42:49 InnoDB: The InnoDB memory heap is disabled
140621 16:42:49 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140621 16:42:49 InnoDB: Compressed tables use zlib 1.2.7
140621 16:42:49 InnoDB: Using Linux native AIO
140621 16:42:50 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140621 16:42:50 InnoDB: Completed initialization of buffer pool
140621 16:42:50 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140621 16:42:50 [ERROR] Plugin 'InnoDB' init function returned error.
140621 16:42:50 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140621 16:42:50 [ERROR] Unknown/unsupported storage engine: InnoDB
140621 16:42:50 [ERROR] Aborting
140621 16:42:50 [Note] /usr/libexec/mysqld: Shutdown complete
140621 16:42:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended更新:在这里找到了正在设置交换文件的答案。我所遵循的关于如何做到这一点的详细信息可以在这里找到:http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html
发布于 2014-06-21 22:01:14
您需要确保mysql用户拥有所有mysql文件。验证mysql日志文件是否属于MySQL用户。
ls -l /var/log/mysql*如果没有设置适当的所有者:
chown mysql:mysql /var/log/mysql....对my.cnf中列出的所有目录执行相同的操作:
root# grep mysql /etc/mysql/my.cnf
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /data/mysql
log_bin=/data/mysql/binlogs/mysql-bin.log
slow_query_log_file=/var/log/mysql_slow_query.log
log-error=/var/log/mysql_error.log
innodb_data_home_dir = /data/mysql对于目录,使用递归chown:
chown mysql:mysql -R /data/mysqlhttps://serverfault.com/questions/606999
复制相似问题