LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 51506|回复: 12

Can't connect to local MySQL server through socket (已解决)

[复制链接]
发表于 2005-8-15 17:34:53 | 显示全部楼层 |阅读模式
[root@fc modules]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@fc modules]#
发表于 2005-8-16 22:22:31 | 显示全部楼层
我的也是这样.唉~~~~
回复 支持 反对

使用道具 举报

发表于 2005-8-16 22:26:16 | 显示全部楼层
先查看 /etc/rc.d/init.d/mysqld status     看看m y s q l 是否已经启动.
另外看看是不是权限问题.
回复 支持 反对

使用道具 举报

发表于 2005-8-17 01:18:58 | 显示全部楼层
首先确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-17 09:59:13 | 显示全部楼层

mysql 的问题

[root@fc sbin]# mysql_install_db
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h fc password 'new-password'
See the manual for more instructions.

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
[root@fc sbin]#
回复 支持 反对

使用道具 举报

发表于 2005-8-17 10:02:49 | 显示全部楼层
什么问题???

兄弟要把问题说清楚;是启动MYSQL??
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-17 10:17:26 | 显示全部楼层
[root@fc sbin]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@fc sbin]#
回复 支持 反对

使用道具 举报

发表于 2005-8-17 10:19:33 | 显示全部楼层
这是没启动mysql的守护进程,执行service mysqld start就行了
回复 支持 反对

使用道具 举报

发表于 2005-8-17 10:21:43 | 显示全部楼层
#chown -R mysql:mysql /var/lib/mysql

[root@localhost beinan]# /etc/init.d/mysqld start
启动 MySQL:                                               [  确定  ]
[root@localhost lib]# mysqladmin -uroot password '123456'
[root@localhost lib]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.11

Type 'help;' or '\h' for help. Type '\c' to clear the buffer
回复 支持 反对

使用道具 举报

发表于 2010-2-20 16:56:48 | 显示全部楼层
我遇到了一模一样的问题,我的原因是mysql-server没有安装
#yum install mysql-server
安装之后就OK了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表