您当前的位置:学习一百学习频道电脑教程大全电脑故障报错代码Can’t connect to local MySQL server through socket ’/tmp/m

Can’t connect to local MySQL server through socket ’/tmp/m

http://www.ybf100.com类型:报错代码发布时间:10-19阅读次数:836
Can’t connect to local MySQL server through socket ’/tmp/m

运行/etc/rc.d/init.d/mysqld start命令后,显示成功登陆MySQL,但是,再想用命令:/usr/local/bin/mysqladmin -u root password 123456 修改数据库密码时,总是提示:
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!

首先:用命令:/usr/local/bin/mysqld_safe --user=mysql&连接数据库,这时系统会自动生成mysql.sock这个文件。
其次,找到mysql.sock这个文件,一般在/var/lib/mysql/mysql.sock这个目录下或/tmp目录下,如果有提示说Can’t connect to local MySQL server through socket ’/tmp/mysql.sock’;我们就可以用软连接的方法解决;
用命令:ln -s /var/lib/mysql/mysql.sock /tmp
这样就可以啦。
最后,你在用:/usr/local/bin/mysqladmin -u root password 123456 修改数据库密码时就不会有问题了。




如果觉得《Can’t connect to local MySQL server through socket ’/tmp/m》不错,可以推荐给好友哦。
Tag:报错代码,报错代码,电脑教程大全 - 电脑故障 - 报错代码
联系本站公文写作人力资源下载学习频道软件下载网站地图精品教程热门专题