MySQL root密码重置 报错:mysqladmin: connect to server at 'localhost' failed的解决方案

===========================================================
二,忘记本地root的登录密码
解决过程:
1、编辑/mysql/my.ini
在[mysqld] 配置部分添加一行
skip-grant-tables
 
2、保存后重启mysql
[[email protected] etc]# service mysqld restart
Shutting down MySQL.                                       [  OK  ]
Starting MySQL.                                                   [  OK  ]

3、登录数据库重新设置root密码
[[email protected] ~]# mysql -u root -p mysql
Enter password:
直接回车进入

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.47-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

执行下列语句

mysql>use mysql;
mysql> update user set password=password("mysql") where user=‘root‘;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
4、删除/etc/my.cnf文件中添加的“skip-grant-tables”行,重启mysql;
用新设的密码就能正常登录了;

MySQL root密码重置 报错:mysqladmin: connect to server at 'localhost' failed的解决方案

时间: 2024-08-07 03:56:12

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.安装完MySQL设置root密码报错如下 [root@vm172-31-0-6 data]# mysqladmin -uroot password "linux@123" mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root

MYSQL登录错误:mysqladmin: connect to server at ‘localhost’ failed

一.mysql登录错误 mysqladmin: connect to server at 'localhost' failed       error: 'Access denied for user 'root'@'localhost' (using password: YES)' 解决办法:破解mysql密码 #> service mysqld stop       #>mysqld_safe --skip-grant-tables &       输入 mysql -uroot

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: 'Access denied for user 'root'@'localhost' (using password: YES)'无法修改密码用 service mysqld stopmysqld_safe --skip-grant-tables &输入 mysql -uroot -p 回车进入>use

MYSQL登录错误:mysqladmin: connect to server at 'localhost' failed

一.mysql登录错误mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user 'root'@'localhost' (using password: YES)'无法修改密码用 service mysqld stopmysqld_safe --skip-grant-tables &输入 mysql -uroot -p 回车进入>use mysql;> update user set

mysqladmin: connect to server at 'localhost' failed

1:mysqladmin: connect to server at 'localhost' failed 2: 3: 4: mysqladmin: connect to server at 'localhost' failed

mysql忘记root密码或报错:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘xx‘

有的时候忘记了root密码或其他用户的密码,登录的时候报错:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database 'xx'.下面是具体的解决方法: 1.关闭mysql #service mysqld stop 2.屏蔽权限 # mysqld_safe --skip-grant-table 3.新开起一个终端输入 # mysql -u root mysql # mysql> UPDATE user SET Pass

mysql root 密码重置

前情:入职的当天,前任就离职了,除了留下IP地址和域名的对应关系和几个ftp账号密码以外啥都没有,因为公司和他有些利益没有结算清楚,所以很多问题也不配合交接.无奈重置官网mysql的root密码 步骤1:在少人使用的时候 vim /etc/my.cnf 在[mysqld]的段中加一句:skip-grant-tables 保存退出vi 步骤2:重启mysqld :service mysqld restart 步骤3:输入mysql命令 USE mysql; UPDATE user SET Pass

Mac下忘记Mysql root密码重置

很久之前安装的mysql 在 mac本机,突然要用的时候,发现怎么也连接不上,网上找了很多的教程尝试都不成功,最后找到一篇尝试成功.感谢原博主的分享转载在下面进行记录,出处: http://blog.csdn.net/u014410695/article/details/50630233 以下方法亲测有效,过程使用的工具只有mac的终端无需workbench 当我们通过终端连接MySQL数据库时候我们会看到这样的信息 ERROR 1045: Access denied for user: '[e

Centos 下 mysql root 密码重置

重置mysql密码的方法有很多,官网也提供了很方便的快捷操作办法,可参考资料 resetting permissions .本文重置密码的具体步骤如下: 一.停止MySQL(如果处于运行状态) #service mysqld stop 输出 Shutting down MySQL. [ OK ] 关于 #service mysqld stop 命令,可参考 CENTOS 6.5 平台离线编译安装 Mysql5.6.22. 二.启动MySQL_safe,如此以来便可不用密码登录MySQL # my