-- ====================================================================
-- mysqladmin: connect to server at 'localhost' failed的解决方案!
-- ====================================================================
1 登陆失败,mysqladmin修改密码失败
[root@mysql var]# mysqladmin -u root password '123456'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
2 停止mysql服务
[root@mysql var]# /etc/init.d/mysqld stop
Shutting down MySQL.... SUCCESS!
3 安全模式启动
[root@mysql var]# mysqld_safe --skip-grant-tables &
/opt/mysql/product/5.5.25a/bin/mysqld_safe --skip-grant-tables &
[1] 10912
[root@mysql var]# 110407 17:39:28 mysqld_safe Logging to '/usr/local/mysql/var//mysql.chinascopefinanical.com.err'.
110407 17:39:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var/
4 无密码root帐号登陆
[root@mysql var]# /usr/bin/mysql -uroot -p
【注释,在下面的要求你输入密码的时候,你不用管,直接回车键一敲就过去了】
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.1.41-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Database changed
5 手动update修改密码
mysql> update user set password=password("guxxxxxahyVh") where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@mysql var]# mysql -uroot -pguNNhtqhjUnfky6ahyVh
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 172
Server version: 5.1.41-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit
Bye
6 正常重新启动
[root@mysql var]# service mysqld restart
Shutting down MySQL..110407 17:45:29 mysqld_safe mysqld from pid file /usr/local/mysql/var//mysql.chinascopefinanical.com.pid ended
SUCCESS!
Starting MySQL.. SUCCESS!
[1]+ Done mysqld_safe --skip-grant-tables
[root@mysql var]#
7 其他形式的错误情况分析
7.1 找不到sock 报错 :
[root@app60 mysqld]# /usr/bin/mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
[root@app60 mysqld]#
登陆的时候加上sock参数就OK了。
[root@app60 mysqld]# /usr/bin/mysql -uroot -p --socket=/opt/mysqldata/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql>
7.2 抱错 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G
130830 10:59:02 InnoDB: Completed initialization of buffer pool
130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496
130830 10:59:02 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
130830 10:59:02 [ERROR] Can't start server: can't create PID file: No space left on device
130830 10:59:02 mysqld_safe Number of processes running now: 0
130830 10:59:02 mysqld_safe mysqld restarted
130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G
130830 10:59:02 InnoDB: Completed initialization of buffer pool
130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496
130830 10:59:02 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
130830 10:59:02 [ERROR] Can't start server: can't create PID file: No space left on device
130830 10:59:03 mysqld_safe Number of processes running now: 0
130830 10:59:03 mysqld_safe mysqld restarted
130830 10:59:03 InnoDB: Initializing buffer pool, size = 1.0G
[分析]:不能写入默认的pid文件,就 修改 /etc/init.d/mysqld,把pid指向别的路经
[root@app60 mysqld]# vi /etc/init.d/mysqld
.....
get_mysql_option mysqld datadir "/var/lib/mysql"
datadir="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
socketfile="$result"
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/opt/mysqldata/mysqld.pid" # '/var/run/mysqld/mysqld.pid' 原始值,这里修改成别的路径/opt/mysqldata/mysqld.pid
mypidfile="$result"
.....
然后启动mysqld服务,OK,成功了。
MySQL root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案!的更多相关文章
-
MySQL忘记密码,或:root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案
MySQL root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案 1 登陆失败,mysqladmin修改密码失败 ...
-
MySQL root密码重置 报错:mysqladmin: connect to server at 'localhost' failed的解决方案
===========================================================二,忘记本地root的登录密码解决过程:1.编辑/mysql/my.ini在[my ...
-
MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed
MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed 1.安装完MySQL设置root密码报错如下 [root@vm ...
-
mysql修改密码与password字段不存在mysqladmin connect to server at localhost failed
mysqladmin: connect to server at 'localhost' failed 停止mysql服务 systemctl stop mysql 安全模式启动 chown -R m ...
-
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'
就当作自己忘记Mysql密码把,忘记密码的解决方法 一.mysql登录错误mysqladmin: connect to server at 'localhost' failederror: 'Acce ...
-
MYSQL登录错误:mysqladmin: connect to server at ‘localhost’ failed
一.mysql登录错误 mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user ...
-
mysqladmin: connect to server at 'localhost' failed
1:mysqladmin: connect to server at 'localhost' failed 2: 3: 4:
-
MariaDB:登陆报错:mysqladmin: connect to server at 'localhost' failed
见图: 解决办法: /etc/init.d/mysqld stop mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ...
-
wamp5 忘记mysql root密码 重置方法
wamp5比较恶心,忘记mysql root密码了,重新安装都没用,网上找了个文章可以修改root的密码. http://www.kuqin.com/database/20080306/4249.ht ...
随机推荐
-
细说ASP.NET Core静态文件的缓存方式
一.前言 我们在优化Web服务的时候,对于静态的资源文件,通常都是通过客户端缓存.服务器缓存.CDN缓存,这三种方式来缓解客户端对于Web服务器的连接请求压力的. 本文指在这三个方面,在ASP.NET ...
-
基于 debootstrap 和 busybox 构建 mini ubuntu
基于 debootstrap 和 busybox 构建 mini ubuntu 最近的工作涉及到服务器自动安装和网络部署操作系统,然后使用 ansible 和 saltsatck 进行配置并安装 op ...
-
数据统计表插件,highcharts插件的简单应用
highcharts插件的简单应用,非常全能好用的一个数据统计表插件. $(function () { $('#container').highcharts({ chart:{ type:" ...
-
IIS 8 下使用 WCF
按照以下步骤添加后,IIS8即支持WCF服务. 首先添加MIME类型 扩展名“.svc”,MIME类型 “application/octet-stream” 2. 然后在“Handler Mappin ...
-
python安装问题
安装MinGW之后 出现.. 解决方案 ================
-
基于HTTP和TFTP的PXE批量自动化安装Linux系统
CentOS 6.5 PXE自动化部署系统 拓扑图如下: 步骤: 1. 安装http服务,上传ISO文件 [root@UCS-1 ~]# yum install httpd –y [root@UCS ...
-
json-c代码示例
#include <stdio.h> #include <string.h> #include <json.h> int main(int argc,char ** ...
-
元组-tuple功能介绍
#元组 不可变类型 相当于只读的列表,不可被修改,不可被修改哦 ##创建元组最后加,最后加, 形成良好的习惯 """ tuple() -> empty tuple ...
-
Oracle undo我们需要掌握什么
<Oracle undo我们需要掌握什么> 引言:undo 是Oracle数据库的重要组件,刚入门的朋友建议要把undo的原理和机制理解明白,尤其是和redo组件的区别和联系.了解undo ...
-
Raspberry Pi GPIO Protection
After damaging the GPIO port on our raspberry pi while designing a new solar monitoring system we de ...