通过套接字连接到本地MySQL服务器 [英] connect to local MySQL server through socket

查看:274
本文介绍了通过套接字连接到本地MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误2002(HY000):无法通过套接字'/var/run/mysqld/mysqld.sock'(2)连接到本地MySQL服务器

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

我尝试了在互联网上找到的所有内容,但是无法解决在Ubuntu 11.04上出现的问题.

I tried everything I found on internet, but cannot solve the problem on Ubuntu 11.04.

我尝试了这些事情:

  • 使用sudo /usr/sbin/mysqld start
  • 手动启动mysqld
  • 使用service mysqld start
  • 启动mysqld
  • 使用ps ax | grep mysqld检查它是否正在运行,并得到结果3419 pts/0 S+ 0:00 grep --color=auto mysqld
  • /var/run/mysqld/mysqld.sock
  • 上手动创建文件
  • 授予mysql用户权限
  • 试图删除并重新安装,但仍然无法正常工作
  • 尝试了tasksel来配置LAMP,其他所有东西都可以工作,但是mysql会产生相同的错误.
  • started mysqld manually using sudo /usr/sbin/mysqld start
  • started mysqld using service mysqld start
  • Checked it is running using ps ax | grep mysqld and got result 3419 pts/0 S+ 0:00 grep --color=auto mysqld
  • created the file manually at/var/run/mysqld/mysqld.sock
  • Gave rights to mysql user
  • Tried to remove and re-install but it still do not work
  • Tried tasksel to configure LAMP, every thing else works but mysql generate same error.

mysqld -P 3305一起运行时,会生成错误

When run with mysqld -P 3305 it generates the error

110630  0:24:24 [Warning] Can't create test file /var/lib/mysql/nazar-studio.lower-test
110630  0:24:24 [Warning] Can't create test file /var/lib/mysql/nazar-studio.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
110630  0:24:24 [ERROR] Aborting

110630  0:24:24 [Note] mysqld: Shutdown complete

这是mysql错误日志

Here is the mysql error log

10630  0:07:22 [Note] Plugin 'FEDERATED' is disabled.
110630  0:07:22  InnoDB: Initializing buffer pool, size = 8.0M
110630  0:07:22  InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
110630  0:07:22  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
110630  0:07:22  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
110630  0:07:22  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110630  0:07:23  InnoDB: Started; log sequence number 0 0
110630  0:07:23  InnoDB: Starting shutdown...
110630  0:07:28  InnoDB: Shutdown completed; log sequence number 0 44233
110630  0:07:28 [Note] Plugin 'FEDERATED' is disabled.
110630  0:07:28  InnoDB: Initializing buffer pool, size = 8.0M
110630  0:07:28  InnoDB: Completed initialization of buffer pool
110630  0:07:28  InnoDB: Started; log sequence number 0 44233
ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1
110630  0:07:28 [ERROR] Aborting

110630  0:07:28  InnoDB: Starting shutdown...
110630  0:07:34  InnoDB: Shutdown completed; log sequence number 0 44233
110630  0:07:34 [Note] /usr/sbin/mysqld: Shutdown complete

110630  0:07:34 [Note] Plugin 'FEDERATED' is disabled.
110630  0:07:34  InnoDB: Initializing buffer pool, size = 8.0M
110630  0:07:34  InnoDB: Completed initialization of buffer pool
110630  0:07:34  InnoDB: Started; log sequence number 0 44233
110630  0:07:34  InnoDB: Starting shutdown...
110630  0:07:39  InnoDB: Shutdown completed; log sequence number 0 44233
110630  0:07:39 [Note] Plugin 'FEDERATED' is disabled.
110630  0:07:39  InnoDB: Initializing buffer pool, size = 8.0M
110630  0:07:39  InnoDB: Completed initialization of buffer pool
110630  0:07:39  InnoDB: Started; log sequence number 0 44233
ERROR: 1050  Table 'plugin' already exists
110630  0:07:39 [ERROR] Aborting

110630  0:07:39  InnoDB: Starting shutdown...
110630  0:07:44  InnoDB: Shutdown completed; log sequence number 0 44233
110630  0:07:44 [Note] /usr/sbin/mysqld: Shutdown complete

110630  0:18:30 [Note] Plugin 'FEDERATED' is disabled.
110630  0:18:30  InnoDB: Initializing buffer pool, size = 8.0M
110630  0:18:30  InnoDB: Completed initialization of buffer pool
110630  0:18:30  InnoDB: Started; log sequence number 0 44233
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
110630  0:18:30 [ERROR] Aborting

110630  0:18:30  InnoDB: Starting shutdown...
110630  0:18:35  InnoDB: Shutdown completed; log sequence number 0 44233
110630  0:18:35 [Note] mysqld: Shutdown complete

如何解决此错误?

推荐答案

我做了实验,最后用这些命令解决了

I did experiments and finally solve it with these commands

sudo chown mysql:root /var/lib/mysql/ -R
sudo chmod g+rw /var/lib/mysql/ -R
sudo /usr/sbin/mysqld --skip-grant &

它开始运行了……Hurraaahhhhhhhhh !!!!!!!!!!!!

It get running...... Hurraaahhhhhhhhhh!!!!!!!!!!!!

这篇关于通过套接字连接到本地MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆