网络家园
公告
站内搜索
分类
首页
网络生活(2)
Linux随笔(19)
FreeBSD/Uinx(0)
MSSQL教程(0)
Windows点滴(15)
学无止境(0)
最新日志
weblogic8.1找回密码的方法
NET命令的另类用法
常用DOS网络命令
RedHat linux网络配置文件详解
IIS服务命令
随心订制linux透明防火墙
Linux下iptables原理解析
删除Windows2000/XP/2003 默认共享
windows禁用端口
点到点之间的建立隧道方法
Internet Explorer 缺少地址栏
计算机的地址栏消失了怎么办?
VSS服务器安装配置
Windows注册表被禁用和恢复
Windows服务器安全设置经验详谈
防止ASP木马在服务器上运行技巧
防范拒绝服务攻击妙招儿
修改注册表对付病毒木马及黑客
透过现象轻松解决Ping故障
Windows系统垃圾清除
最新评论
Good site
Good site
Good site
Good site
Good site
Good site
Good site
Good site
Good site
Good site
我的链接
留言
<写留言>
Information
Interesting sites
Information
Information
Interesting pages
Information
统计信息
日志总数:36
今日访问:304
访问总数:163024
评论总数:7
留言总数:6
历史存档
2006年02月(3)
管理入口
用户名
密 码
RSS
北方博客 > 首页 > Can’t connect to local MySQL server through socket 解决办法

[Linux随笔]Can’t connect to local MySQL server through socket 解决办法
chcn 发布于 2007-05-20 00:56

Tags: -

启动mysql 报错:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
另外看看是不是权限问题.

2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock

3、试试:service mysqld start

4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql

[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost ~]# mysql -uroot -p

 

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
   原因是,/var/lib/mysql 的访问权限问题。

shell> chown -R mysql:mysql /var/lib/mysql

接着启动服务器

shell> /etc/init.d/mysql start

服务器正常启动后察看 /var/lib/mysql 自动生成mysql.sock文件。

但是我的问题仍然没有得到解决。

问题终于解决:
方法:    修改/etc/my.conf:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/usr/local/mysql

If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:

[client]
socket=/var/lib/mysql/mysql.sock


发现依旧如此,运行/etc/init.d/mysql start报错:    Starting MySQLCouldn't find MySQL manager or server
是mysqld服务没启,运行/usr/local/mysql/bin/mysqld_safe &

问题解决。


发表评论
 
昵称
主页
标题
内容
算式的解
看不清校验算式?