启动MySQL守护程序时遇到问题

时间:2012-07-28 15:49:38

标签: mysql database daemon dedicated-server

我是新来的论坛,但我希望变得更加活跃,因为我最近购买了一台专用服务器,而且我正在运行Fedora,所以这是一个不断学习的过程,我在BASH相当平均,但我知道足以让我走动,我是一个软件开发人员,交易的不仅仅是网络技术。这引出了我最初的问题,我在重新启动dedi后启动MySQL守护进程时出现问题,我不知道为什么突然这样做,我从服务器运行PHPMyAdmin并通过CLI发出某些命令MySQL,但重启后我每次尝试启动守护进程的实例时都会收到此错误:

[root@ks23085 ~]# service mysqld start
Redirecting to /bin/systemctl  start mysqld.service
[root@ks23085 ~]# systemctl mysqld start
Unknown operation mysqld
[root@ks23085 ~]# systemctl start mysqld
Failed to issue method call: Unit name mysqld is not valid.
[root@ks23085 ~]# systemctl start mysqld.service
[root@ks23085 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysql.sock' (2)

它完全奇怪,因为它在重新启动它之前工作得很好,我没有更新它或更改安装,我唯一做的就是安装postfix,但我不明白为什么会导致任何问题使用MySQL:S

我真的需要一手这个,我已经尝试了谷歌的几个解决方案,没有任何结果。先谢谢你们。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

更新1:

好的,所以我找到了mysqld所在的目录,它是'/ usr / libexec / mysqld',我在这个目录中键入'./mysqld start',它指定了这个输出:

120729  1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
./mysqld: Can't change dir to '/run/mysql/' (Errcode: 2)
120729  1:49:09 [ERROR] Aborting

120729  1:49:09 [Note] ./mysqld: Shutdown complete

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 更新2:

我设法通过在所有旧数据库的'run /'中创建'mysql'目录来传递目录问题,但现在我似乎收到一个似乎不太容易修复的错误: /

这是输出:

120729  2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729  2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729  2:15:59 [Note] Plugin 'FEDERATED' is disabled.
120729  2:15:59 [Note] Plugin 'InnoDB' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
120729  2:15:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120729  2:15:59 [ERROR] mysqld: unknown option '--skip-locking'
120729  2:15:59 [ERROR] Aborting

120729  2:15:59 [Note] mysqld: Shutdown complete

1 个答案:

答案 0 :(得分:1)

official doc表示此错误有两种可能的原因:

  
      
  1. 您无权访问目录/var/lib/mysql/whatever.sock,因为mysql是该文件夹的所有者   或
  2.   
  3. /path/whatever.sock不存在。
  4.   

执行以下命令查找套接字:

mysqladmin variables | grep socket

按建议添加到配置文件中:

  

你可以试试这个[Linux特定的,但其他什么操作   有系统吗?]转到/etc/my.cnf并更改/添加行:

     

[mysqld]

     

datadir = / var / lib / mysql

     

插座= / TMP /的mysql.sock

     

[客户]

     

插座= / TMP /的mysql.sock

2)不要忘记检查你的权限!