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

1.安装完MySQL设置root密码报错如下

[root@vm172--- data]# mysqladmin -uroot password "linux@123"
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

2.停止MySQL服务

[root@vm172--- ~]# systemctl stop mysqld.service

3 安全模式启动

[root@vm172--- mysql]# mysqld_safe --skip-grant-tables &
[]
[root@vm172--- mysql]# :: mysqld_safe Logging to '/var/log/mysqld.log'.
:: mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

4 无密码root帐号登陆

[root@vm172--- mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-log MySQL Community Server (GPL) Copyright (c) , , 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> use mysql;
Database changed

5 手动update修改密码

mysql> update user set password=password("linux@123") where user='root' and host='localhost';
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> flush privileges;
Query OK, rows affected (0.00 sec) mysql> quit
Bye

重新使用密码登录

[root@vm172--- mysql]# mysql -uroot -plinux@
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-log MySQL Community Server (GPL) Copyright (c) , , 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>

6 正常重新启动

[root@vm172--- ~]# service mysqld start

#查看进程

[root@vm172--- ~]# ps -ef|grep mysql
root : pts/ :: tail -f -n /var/log/mysqld.log
mysql : ? :: /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql : ? :: /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root : pts/ :: grep --color=auto mysql

#查看端口号

[root@vm172--- ~]# netstat -lntup|grep
tcp 0.0.0.0: 0.0.0.0:* LISTEN /mysqld

至此mysql密码修改完成。

MySQL 设置root密码报错:mysqladmin: connect to server at 'localhost' failed的更多相关文章

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

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

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

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

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

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

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

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

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

  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. mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    注:本文来源于<  mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy r ...

随机推荐

  1. python3读取sqlyog配置文件中的MySql密码

    这个人有什么目的?: 我多多少少听过一些安全圈的大牛说到类似的思路,大意是可以通过扫描各种程序和服务的配置文件(比如SVN的文件,RSYNC的配置文件等), 从中发现敏感信息,从而找到入侵的突破口.沿 ...

  2. idea 控制到不能输出中文

    解决办法:配置Tomcat的时候在VM options添加  -Dfile.encoding=UTF-8

  3. python网络编程(UDP+广播)

    UDP广播案例,一端发送,多端接受: 发送端: # UDP广播案例 from socket import * from time import sleep # 设定目标地址 dest=('176.21 ...

  4. 剑指Offer 62. 二叉搜索树的第k个结点 (二叉搜索树)

    题目描述 给定一棵二叉搜索树,请找出其中的第k小的结点.例如, (5,3,7,2,4,6,8)    中,按结点数值大小顺序第三小结点的值为4. 例如, 5 / \ 3 7 / \ / \ 2 4 6 ...

  5. 周强 201771010141面向对象程序设计(java)》第十七周学习总结

    线程同步 多线程并发运行不确定性问题解决方案:引入线 程同步机制,使得另一线程要使用该方法,就只 能等待. ⚫ 在Java中解决多线程同步问题的方法有两种: 1.- Java SE 5.0中引入Ree ...

  6. leetcode 买卖股票问题

    leetcode121 Best Time to Buy and Sell Stock 说白了找到最大的两组数之差即可 class Solution { public: int maxProfit(v ...

  7. 大数据 - hadoop三台linux虚拟服务器 - 初始化部署

    搭建hadoop环境 1.解压Hadoop的安装包,解压到modules文件夹中.(安装包下载地址:http://archive.apache.org/dist/hadoop/core/hadoop- ...

  8. classLoader和Class.forName的区别

    public class ClassLoaderOrClassForName{ public static void main(String[] args) throws ClassNotFoundE ...

  9. Autolayout Breakpoints

    articles archives team Autolayout Breakpoints Auto layout has become a crucial tool for iOS and OS X ...

  10. jQuery-4.动画篇---jQuery核心

    jQuery中each方法的应用 jQuery中有个很重要的核心方法each,大部分jQuery方法在内部都会调用each,其主要的原因的就是jQuery的实例是一个元素合集 如下:找到所有的div, ...