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. vim替换tab到4空格

    ~/.vimrc 中设置 # 设置tab宽度 set ts= #也可以用 set tabstop= #空格替换tab set expandtab 如果对于已保存的文件 :%retab! !用于修改所有 ...

  2. 关于windows映射网络驱动器,登录时重新连接

    如果想登录系统后映射盘符还在,但是不自动连接,则参考下面方法.方法其实很简单,关键的步骤是:登录共享的时候,登录界面取消选中“保存凭据”,然后映射的时候,选择“下次开机是重新连接” 这样,下次开机的时 ...

  3. Shell bash 数学运算 bc

    1.bc命令可以完成浮点数的运算.其中 scale可以指定保留的小数点位数. 2.举例 例1: 例2:

  4. Scrapy创建项目问题

    创建项目时报错 ModuleNotFoundError: No module named 'cryptography.hazmat.bindings._constant_time' pip insta ...

  5. [转载]前端 阿里p6面试题集锦含答案

    1.说一下你了解CSS盒模型. 盒模型分为:IE的怪异盒模型和标注浏览器的盒模型,然后可以通过box-sizing属性控制两种盒模型的变换. 2.说一下box-sizing的应用场景. 这个也不难,简 ...

  6. redis命令String类型(四)

    String 字符串类型 命令: 1> 赋值 语法:set key value 比如:set test 123 2> 取值 语法:get key 比如:get test 3> 取值并 ...

  7. erlang开发工具之intellij idea基本使用

    其他废话就不多说了,接下来主要是介绍怎么来用idea搭建项目让我们能更好的使用好开发工具. (这边假设你已经下载好了intellij idea关于erlang的插件,如果没有安装好,请先去google ...

  8. Netty 中 EventLoopGroup 的创建

    本文是基于 Netty 4.1.6.Final 的源码来分析的. 在分析源码之前做一些准备工作: 先熟悉一下 IDEA 的几个快捷键,能极大的提高我们查看源码的效率: Ctrl + Alt + B:用 ...

  9. mpvue开发小程序记录

    1.同一组件内嵌套的 v-for 不能连续使用相同的索引,目前为: index,index <li v-for="(list, index) in datas" :key=& ...

  10. es6学习笔记-Proxy、Reflect、Promise

    Proxy Proxy 用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程. Proxy 可以理解成,在目标对象之前 ...