ERROR 2002(HY000):无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(2)
我尝试了在互联网上找到的所有内容,但无法在Ubuntu 11.04上解决问题。
我试过这些东西:
sudo /usr/sbin/mysqld start
service mysqld start
ps ax | grep mysqld
并获得结果3419 pts/0 S+ 0:00 grep --color=auto mysqld
/var/run/mysqld/mysqld.sock
mysql
用户tasksel
配置LAMP,其他所有工作都有效但mysql会生成相同的错误。使用mysqld -P 3305
运行时会生成错误
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错误日志
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
如何解决此错误?
答案 0 :(得分:16)
我做了实验,最后用这些命令解决了
sudo chown mysql:root /var/lib/mysql/ -R
sudo chmod g+rw /var/lib/mysql/ -R
sudo /usr/sbin/mysqld --skip-grant &
它开始运行...... Hurraaahhhhhhhhhh !!!!!!!!!!!!
答案 1 :(得分:4)
您的日志实际上告诉您问题:
mysqld:太多的论点(第一个额外的是'开始')。
只需启动守护程序,不要使用' start'。而不是:
sudo / usr / sbin / mysqld start
应该只是:
sudo / usr / sbin / mysqld
答案 2 :(得分:1)
它看起来要么无法在/ var / lib / mysql /中创建文件。如果您查看errode 13,通常意味着权限错误。
1)确保mySQL可以写入目录/ var / lib / mysql和/或mySQL拥有该目录。做一个:
cd /var/lib ; ls -la | grep mysql
可以肯定。
2)如果您尝试从mySQL用户开始,请使用root启动它(您可能是,但值得检查)。
3)如果您正在运行类似SElinux的东西,请确保为mySQL访问启用它。我怀疑是这种情况,但值得检查。
4)小注意:不要创建sock文件 - 一旦启动并正常运行,mysql将创建一个。如果它仍在运行目录中,请将其删除。
答案 3 :(得分:1)
如果您安装了多个mysql服务器,请确保运行正确的MYSQL或更改路径设置。例如:
/opt/lampp/bin/mysql -u root -p
我安装了XAMPP,解决方案对我有用。
答案 4 :(得分:0)
尝试使用(这可能取决于您的操作系统)终止套接字
rm /var/lib/mysql/mysql.sock rm:删除套接字`/var/lib/mysql/mysql.sock'? ÿ 重启服务
service mysqld start
答案 5 :(得分:0)