启动MYSQL提示:Can’t connect to MySQL through socket ‘/tmp/mysql.sock’

启动MYSQL是出现以下错误:

[root@www ~]# /usr/local/webserver/mysql/bin/mysqladmin -u root -p 12345678
Enter password:
/usr/local/webserver/mysql/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (111)’
Check that mysqld is running and that the socket: ‘/tmp/mysql.sock’ exists!

解决方法:

 代码如下 复制代码

[root@www ~]# /usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.1.38-log Source distribution

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql>

mysql的参数说明:

/usr/local/webserver/mysql/bin/mysql –help | less

列举常用参数:

-u, –user=name     User for login if not current user.
-p, –password[=name]
                      Password to use when connecting to server. If password is
                      not given it’s asked from the tty.
-S, –socket=name   Socket file to use for connection.

另一种解决办法

我通过vim /etc/my.cnf,修改了[mysqld]选项下面的socket的值

 代码如下 复制代码
socket=/var/lib/mysql/mysql.sock

ok,mysqld可以启动了

接下来,是mysql启动不了,同样,vim /etc/my.cnf,添加了如下脚本:

[mysql]

 代码如下 复制代码
socket=/var/lib/mysql/mysql.sock

然后,mysqladmin启动不了,还是一样,在[mysqladmin]下面socket值设置为同样的路径
ok,可以启动了

时间: 2024-09-14 08:06:42

启动MYSQL提示:Can’t connect to MySQL through socket ‘/tmp/mysql.sock’的相关文章

Can t connect to local MySQL server through socket /tmp/mysql.sock

不能通过'/tmp/mysql.sock'连到服务器,而php标准配置正是用过'/tmp/mysql.sock',但是一些mysql安装方法将 mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通过修改/etc/my.conf文件来修正它 首先是mysqld启动不了, 我通过vim /etc/my.cnf,修改了[mysqld]选项下面的socket的值 socket=/var/lib/mysql/mysql.sock ok,mysqld可以启动了 接下来,

XtraBackup出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Xtrabackup做备份时遇到下面错误信息MySQL server: Can't connect to local MySQL server through socket '/tmp/mysql.so'(2)   [root@MySQL-DB ~]# innobackupex --defaults-file=/usr/my.cnf --user=root --password=password  /mnt/resource/mysql_backup 160322 22:28:43 innoba

解决Can't connect to local MySQL server through socket '/tmp/mysql.sock'错误

风信网(ithov.com)原创文章:刚安装完mysql,进行运行测试,报Can't connect to local MySQL server through socket '/tmp/mysql.sock'错误, [root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe 131206 22:42:51 mysqld_safe Logging to '/var/log/mysqld.log'. 131206 22:42:51 mysqld

mysql提示Can t connect to MySQL server on localhost (10061)

我们知道是升级了一个升级包靠成了就直接删除就了,后来百度知道原来 是KB967723补丁引起的. 进入"控制面板 - 添加和删除程序 - (勾选上方的"显示更新")"找到KB967723这个补丁,点击删除然后选择" 是",继续卸载.卸载完成后程序服务器 其它问题解决办法分享,解决方法(针对WIN系统): 1, 首先到系统服务里面找到MYSQL服务并启动MYSQL服务. 2, 到MYSQL安装目录找到MY.INI文件,打开MY.INI查找max_c

“Can't connect to local MySQL”提示

今天连接mysql数据库的时候遇到一个问题:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 方案1. 1.#ps -A|grep mysql 显示类似: 1829 ? 00:00:00 mysqld_safe 1876 ? 00:00:31 mysqld 2.#kill -9 1829 3.#kill -9 1876 4.#/etc/init.d/mysql restart 5.#mysql -u

Ruby on Rails 3 Can't connect to local MySQL server through socket '/tmp/mysql.sock' on linux

Ruby on Rails 3 Can't connect to local MySQL server through socket '/tmp/mysql.sock' on linux 解决办法: up vote1down voteaccepted First, to find your socket file: mysqladmin variables | grep socket For me, this gives: | socket | /tmp/mysql.sock | 2  Then

tomcat通过socket连接MySQL,不再占用服务端口【linux】

MySQL连接方式的说明 http://icbm.iteye.com/blog/1840673 MySQL除了最常见的TCP连接方式外,还提供SOCKET(LINUX默认连接方式).PIPE和SHARED MEMORY连接方式.  各连接方式的服务器.客户端启动选项,及连接默认值见下表:  TCP连接(Linux,Windows):  目标 启动选项 默认值 SERVER --port=PORT 3306 CLIENT --protocol=TCP --port=PORT 3306 SOCKET

mysql linux-linux上mysql可以正常启动,却打mysql提示错误进不去

问题描述 linux上mysql可以正常启动,却打mysql提示错误进不去 service mysqld start Starting mysqld: [ OK ] [root@chanct201 etc]# [root@chanct201 etc]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '--default-character-set=utf8' (2) [root@chanc

php运行提示Can't connect to MySQL server on 'localhost'的解决方法_Mysql

错误编号:2003 问题分析: 无法连接到 MySQL 服务器,可能的情况为: 1.MySQL 服务没有启动,一般是在异常的情况下 MySQL 无法启动导致的,比如无可用的磁盘空间,my.ini 里 MySQL 的 basedir 路径设置错误等: 2.MySQL 服务器资源紧张,导致无法连接. 解决方法: 1.如果你是虚拟主机用户(购买的空间),则联系空间商检查 MySQL 是否正常启动,并确认 MySQL 的配置信息(是否为 localhost): 2.如果你是独立主机用户(拥有管理主机权限