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. pytest自动化7:assert断言

    前言:assert断言就是将实际结果和期望结果做对比,符合预期结果就测试pass,不符合预期就测试failed. 实例1:简单断言 实例1优化版--增加异常信息文字描述 异常断言 excinfo 是一 ...

  2. jQuery常用 遍历函数

    jQuery 遍历函数包括了用于筛选.查找和串联元素的方法.本文主要介绍日常工作中常用的JQ遍历,帮助一下初学者快速的接触遍历函数,提高自己的代码编写速度,写出更简洁更实用的代码,祝前端的同学们,在前 ...

  3. web前端技术学习

    $.ajax() ajax数据请求方式,交互,跨域等相关问题 一.请求方式 1.$.ajax() $.ajax({ type:"get",//请求方式“get”和“post” ur ...

  4. Groovy学习笔记-实现接口

    1.单个委托方法的实现 button.addActionListener( { println 'Implement ActionListener' } as ActionListener ) 2.实 ...

  5. HTML语言发展史

    .发展时间线 1982年,Tim Berners-Lee 建立 HTML 1993年,大學生的 Marc Andreessen 在他的 Mosaic 浏览器加入 标记,从此可以在Web頁面上浏览图片 ...

  6. VMSTAT监控CPU使用率,内存使用,虚拟内存交换情况

    Linux性能监控分析命令(一)—vmstat命令详解 一.vmstat介绍 语法格式: vmstat [-V] [-n] [-S unit] [delay [count]] -V prints ve ...

  7. failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%', ErrorCode = '0x80070002

    在dotnet core进行开发的时候,需要开发目录直接iis进行部署,然而启动的时候,报异常,我们查看windows下的应用日志发现有个这样的错误信息 Application 'MACHINE/WE ...

  8. 一道笔试题来理顺Java中的值传递和引用传递

      题目如下: private static void change(StringBuffer str11, StringBuffer str12) { str12 = str11; str11 = ...

  9. JAVA005-基本数据类型变量的存储

    1.变量按类型分: 数据类型分为基本数据类型和引用数据类型 引用数据类型包括数组和类等 类定义的变量又叫对象 2.按照作用范围分为: 类级别.对象实例级.方法级.块级 方法级:局部变量 3.字符型的字 ...

  10. Linux 环境下安装Redis的步骤

    #进入usr/local目录cd /usr/local#下载1.wget http://download.redis.io/releases/redis-4.0.10.tar.gz#解压2.tar x ...