启动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。

最新文章

  1. JAVA与数据库MySQL相连接
  2. Java线程的5个使用技巧
  3. duilib进阶教程 -- 改进窗口拖动 (12)
  4. SQL事务回滚样例
  5. xdg-open 打开“irc:*”链接
  6. leetcode:Lowest Common Ancestor of a Binary Search Tree
  7. http keepalive
  8. iOS中的深复制与浅复制
  9. Delphi XE2及以后的版本编译后的程序大小问题
  10. system.getProperties()
  11. 观察者模式与Boost.Signals
  12. 优化tomcat配置(从内存、并发、缓存4个方面)优化
  13. nginx 部署
  14. Java spring boot 2.0连接mysql异常:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone
  15. 《Mem2Seq: Effectively Incorporating Knowledge Bases into End-to-EndTask-Oriented Dialog Systems》
  16. mssqlserver on linux - Linux下尝鲜MSSQL-SERVER【微软大法棒棒哒】
  17. testng优化:失败重跑,extentReport+appium用例失败截图,测试报告发邮件
  18. /src/struts.xml
  19. oracle偏爱hostname
  20. 分析占用了大量CPU处理时间的是Java进程中哪个线程

热门文章

  1. springMVC学习笔记(一)-----springMVC原理
  2. label用js,jquery取值赋值,以及怎么在后台取值
  3. 基于Metronic的Bootstrap开发框架经验总结(12)--页面链接收藏夹功能的实现
  4. C# 关键字extern用法
  5. JavaScript进阶之this
  6. 黑社会团伙(gangs)
  7. MySQL 5.7 create VIEW or FUNCTION or PROCEDURE
  8. luogg_java学习_09_泛型_集合
  9. Eclipse中Python开发环境搭建
  10. JMeter专题系列(六)集合点