ERROR 2002(HY000):无法通过socket' /var/lib/mysql/mysql.sock&#39连接到本地MySQL服务器; (111)

时间:2014-08-26 13:25:06

标签: mysql linux bash sockets

我试图在Linux上使用MySQL。它之前工作得很好但不知何故我搞砸了。现在每当我输入#mysql时,它只会给我标题中的错误。我对这个话题进行了大量的研究,有人说这是my.cnf的问题。所以我试图在/etc/MySQL/my.cnf中找到该文件。但奇怪的是在我的机器上,文件位于/ usr。而且它不仅位于不同的目录中,其内容也很奇怪。

[mysqld]    

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

其他一些网站说我应该检查MySQL是否正在运行。每当我输入

/etc/init.d/mysql status

它只是说-bash:/etc/init.d/mysql:没有这样的文件或目录。

经过无数次尝试,我决定重新安装MySQL。我按照this网站上的说明进行操作。但是,当它完成时会出现同样的问题。

我是否在错误的目录中安装MySQL?或者my.cnf有问题吗?有人请帮忙,因为我已经被困在这里超过2周,仍然无法得到线索。

提前谢谢。

0 个答案:

没有答案