mysql as tmp,启动mysql时显示:/tmp/mysql.sock 不存在的解决办法

启动mysql时显示:/tmp/mysql.sock 不存在的解决方法

启动mysql时显示:/tmp/mysql.sock 不存在的解决方法

启动mysql时报错的解决(mysql 5.0.45 redhat as

43)

===========================================================

启动mysql时报错的解决(mysql 5.0.45 redhat as 43)

作者: lawzjf(http://lawzjf.itpub.net)

发表于: 2008.01.13 01:29

分类: 小企鹅

出处: http://lawzjf.itpub.net/post/417/451262

---------------------------------------------------------------

启动mysql时报错:

Starting mysqld daemon with databases from

/var/lib/mysql

STOPPING server from pid file /var/run/mysqld/mysqld.pid

071112 00:22:06 mysqld ended

查看日志:

#less /var/log/mysqld.log

其中有一段如下:

071112 0:22:06 [ERROR] /usr/local/mysql/bin/mysqld: Can't

create/write to file '/var/run/mysqld/mysqld.pid' (Errcode:

2)

071112 0:22:06 [ERROR] Can't start server: can't create PID

file: No such file or directory

071112 00:22:06 mysqld ended

#cd /var/run/

#ls

mysqld目录不存在,创建它:

#mkdir /var/run/mysqld

#cd /var/run/mysqld

创建文件mysqld.pid:

#touch mysqld.pid

#cd..

#chown -R mysql mysqld .

#cd /usr/local/mysql/

#bin/mysqld_safe --user=mysql &

nohup: ignoring input and redirecting stderr to stdout

Starting mysqld daemon with databases from

/var/lib/mysql

能正常启动

#bin/mysqladmin -u root password root

又出错

[root@localhost mysql]# bin/mysqladmin -u root password

root

bin/mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket

'/tmp/mysql.sock' (2)'

Check that mysqld is running and that the socket:

'/tmp/mysql.sock' exists!

[root@localhost mysql]# bin/mysql -u root -p

Enter password:

ERROR 2002 (HY000): Can't connect to local MySQL server

through socket '/tmp/mysql.sock' (2)

分析:是/tmp/mysql.sock 不存在

# cd /var/lib/mysql/

由于mysql 默认的mysql.sock

是在/var/lib/mysql/mysql.sock,创建符号连接:

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

# bin/mysql -u root

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 1

Server version: 5.0.45 MySQL Community Server (GPL)

Type 'help;' or 'h' for help. Type 'c' to clear the

buffer.

mysql>

修改root 密码

#cd /usr/local/mysql/

#bin/mysqladmin -u root -p password yourpassword

一切ok。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值