错误 MySQL CentOS - 正在启动 MySQL 找不到 MySQL 服务器

错误 MySQL CentOS - 正在启动 MySQL 找不到 MySQL 服务器

我无法在mysql中进行任何操作:

root@server2 [/]# /etc/init.d/mysql status
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
root@server2 [/]# /etc/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/server2.myaddress.com.br.pid).
root@server2 [/]# /etc/init.d/mysql stop
MySQL server PID file could not be found!                  [FAILED]
root@server2 [/]# /etc/init.d/mysql restart
MySQL server PID file could not be found!                  [FAILED]
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/server2.myaddress.com.br.pid).
root@server2 [/]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

我的文件/etc/my.cnf:

root@server2 [~]# cat /etc/my.cnf
[mysqld]
user = mysql
skip-external-locking
key_buffer = 384M
max_allowed_packet=268435456
max_connections = 500
max_user_connections = 35
wait_timeout=40
connect_timeout=10
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8
server-id       = 1
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

在一些帖子里搜索,发现可能是某个程序在拖拽mysql,按照命令检查:

root@server2 [~]# lsof | grep mysql
tailwatch 20718      root  mem       REG        3,5    206553    8922204 /usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/auto/DBD/mysql/mysql.so

yum info mysql 服务器

root@server2 [~]# yum info mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.com
 * extras: centos.chi.host-engine.com
 * updates: mirror.lug.udel.edu
Excluding Packages in global exclude list
Finished
Error: No matching Packages to list

其他信息..

  • 没有运行mysql的进程。
  • CentOS 版本 5.10(最终版)
  • 我已经删除了扩展名为 .err 的文件并重试。但没有效果。
  • 当我尝试在安全模式下启动 mysql 时,显然没有错误。但仍然不起作用,并且任何后续操作都不起作用。
  • 我也尝试过将 ib_logfile 日志移动到 mysql 创建的新文件。尝试失败。

登录 /var/lib/mysql/server2.myaddress.com.br.err

140829 14:23:58 [Note] Plugin 'FEDERATED' is disabled.
140829 14:23:58 [Note] Plugin 'InnoDB' is disabled.
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
140829 14:23:58 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140829 14:23:58 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140829 14:23:58 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
140829 14:23:58 [Note] Server socket created on IP: '0.0.0.0'.
140829 14:23:58 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/proxies_priv.frm' (errno: 13)
140829 14:23:58 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/proxies_priv.frm' (errno: 13)
140829 14:23:58 mysqld_safe mysqld from pid file /var/lib/mysql/server2.myaddress.com.br.pid ended

答案1

这是新的 mysql 服务器还是现有的?它似乎缺少数据文件夹。配置中也没有定义数据文件夹,因此它将使用默认文件夹。

如果您尚未创建 MySQL 数据目录,则需要使用以下命令创建:

mysql_install_db

答案2

errno: 13权限被拒绝,这意味着数据库文件存在,但 MySQL 没有权限访问它们。要解决此问题,请修复权限和 SELinux 上下文。

相关内容