一、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 -p 回车进入
       >use mysql;
       > update user set password=PASSWORD("newpass")where user="root";
       更改密码为 newpassord
       > flush privileges; 更新权限
       > quit 退出

service mysqld restart
       mysql -uroot -p新密码进入

 二,忘记本地root的登录密码

解决过程:

1、编辑/etc/my.cnf

在[mysqld] 配置部分添加一行

skip-grant-tables

2、保存后重启mysql

[root@localhost etc]# service mysqld restart
Shutting down MySQL.                                         [  OK  ]
Starting MySQL.                                                   [  OK  ]

3、登录数据库重新设置root密码

[root@localhost ~]# mysql -uroot -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> 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登录错误:mysqladmin: connect to server at ‘localhost’ failed的更多相关文章

  1. 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 ...

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

    -- ==================================================================== --  mysqladmin: connect to s ...

  3. MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed

    MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed 1.安装完MySQL设置root密码报错如下 [root@vm ...

  4. MySQL忘记密码,或:root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案

    MySQL root密码重置报错:mysqladmin: connect to server at 'localhost' failed的解决方案   1  登陆失败,mysqladmin修改密码失败 ...

  5. mysql修改密码与password字段不存在mysqladmin connect to server at localhost failed

    mysqladmin: connect to server at 'localhost' failed 停止mysql服务 systemctl stop mysql 安全模式启动 chown -R m ...

  6. mysqladmin: connect to server at 'localhost' failed

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

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

    ===========================================================二,忘记本地root的登录密码解决过程:1.编辑/mysql/my.ini在[my ...

  8. 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 ...

  9. mysql登录错误或者密码错误

    一.mysql登录错误 mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root ...

随机推荐

  1. 浅谈由管理者角色引出的B端产品设计思考点

    本文来自网易云社区 作者:任琼瑶 最近一直都在持续跟进云课堂B端的交互设计,在此期间,多多少少遇到了一些不曾遇到过的问题,虽然同是做产品设计,但B端和C端产品的确存在很多不同之处. 首先,当我们在做C ...

  2. iOS Png Crush 错误

    添加新的 png 图片到项目里的时候,出现错误 错误内容: while reading... pngcrush caught libpng error: cound not find file... ...

  3. LOJ121 【离线可过】动态图连通性

    题目链接:戳我 [线段树分治版本代码] 这里面的线段树是时间线段树,每一个节点都要开一个vector,记录当前时间区间中存在的边的标号qwq #include<iostream> #inc ...

  4. Help Jimmy(动态规划)

    点击打开链接 Help Jimmy Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12168   Accepted: 402 ...

  5. 使用memcache或redis限制某个用户或者某ip用户一段时间内最大投票次数

    实现每个用户在某网站10分钟内最多投票5次 function isFrequently($key){ $t = 60*10; $n = 5; $mem = new Memcache(); $mem-& ...

  6. js判断手机端操作系统的两种方法

    //判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL ="http://xxx/xxx.apk"; var browser = { ver ...

  7. Linux(Ubuntu)新建用户只有一个$问题

    参考自: http://www.cnblogs.com/ylan2009/articles/2321177.html 1.用root登录操作 2.查看/etc/passwd文件中新建用户的权限 有没有 ...

  8. JavaScript变量那些事

    引言 JavaScript的变量本质是松散类型的,也就是说其变量就是用于保存特定值的一个名字,变量的值和数据类型可以在脚本执行的生命周期中发生变化.这是一个很有趣很强大的特性,但是也是一个极容易出错误 ...

  9. CSS03--框模型、定位position、浮动

    我们接着“CSS02”,继续学习一些新的样式属性. 1.框模型:   规定了元素框处理  元素内容.内边距(padding).边框(border).外边距(margin,可以是负值)的方式 2.内边距 ...

  10. 调用ajax的返回值,需要再ajax之外的函数体里return,以及同步异步问题

    <html> <head> <meta charset="utf-8"/> <script src="js/jquery-1.1 ...