0

我最近安装了SQLDeveloper并通过它连接到 mysql,之后我遇到以下错误:

[root@tborl01 LATER]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@tborl01 LATER]#

虽然通过 SQLDeveloper与相同凭据的连接是成功的,这意味着mysqld 正在运行。我已经通过SQLDeveloper关闭了连接,并再次尝试通过命令提示符进行连接,但面临同样的错误。

我也尝试过启动/重启 mysql 服务:

service mysql restart

MySQL manager or server PID file could not be found!       [FAILED]
Starting MySQL.................................................................................................../etc/init.d/mysql: line 159: kill: (21944) - No such process
                                                           [FAILED]

Listing running process gives following output( shows mysqld as running)

[root@tborl01 init.d]# ps -eaf | grep mysqld
root      4849     1  0  2011 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/tborl01.pid

mysql     4878  4849  0  2011 ?        02:39:06 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/tborl01.pid --skip-external-locking

root     19572 21368  0 13:42 pts/6    00:00:00 grep mysqld

SQLDeveloper是否更改了某些设置?

4

1 回答 1

0
  1. mysql 不是服务它是 mysqld

  2. 你需要用mysql连接

    mysql -h 127.0.0.1 -u root -p

试着让我知道

于 2012-05-07T08:44:40.873 回答