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对比python2的更新点

    python3对比python2的更新点: Python2官方基础模块:urllib2 第三方功能包:requests python3中urllib库和urilib2库合并成了urllib库. 其中u ...

  2. 小试牛刀 WiFi 远控 + wendu

    废话 少说 直接上代码 DH11三根线  信号线 接2 WiFi 模块  r-------t t--------r en&vcc------3.3v 剩下的 共地的啦 double Fahre ...

  3. PHP判断引入文件是否引入成功

    $included_files = get_included_files(); foreach ($included_files as $filename) { echo "$filenam ...

  4. NodeJS静态文件访问性能测试

    受益于JavaScript语言优秀特点,使NodeJS开发服务端应用很方便,配合NPM官方提供的大量第三方组件,让NodeJS更加如虎添翼.最近,需要使用NodeJS做一个服务端HTML5的游戏服务器 ...

  5. "Loading a plug-in failed The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled"

    The Unarchiver 虽好,但存在问题比我们在mac上zip打包一个软件xcode, 然后copy to another mac, 这时用The Unarchiver解压缩出来的xcode包不 ...

  6. yamux多路复用的使用例子

    yamux yamux 是一个多路复用库.它依赖于底层可靠有序连接.如TCP. 提供基于流的多路利用 例子如下: Server package main // 多路复用 import ( " ...

  7. 面向对象的JavaScript-小结

    Javascript中的类 类是对象的模板,用于创建共享一系列属性和方法的类似对象. 使用new关键字调用函数,可以创建对象实例. function Accommodation(){}; var ho ...

  8. c#中的Cache缓存技术

    1.HttpRuntime.Cache 相当于就是一个缓存具体实现类,这个类虽然被放在了 System.Web 命名空间下了.但是非 Web 应用也是可以拿来用的. 2.HttpContext.Cac ...

  9. Zedboard搭建Linux嵌入式环境

    ZYNQ是ARM硬核和PL软核的结合体,Xillybus官方为他开发了驱动套件Xillinux,赶快将开发板投入使用吧! 本随笔参考了众多博主和官方教程:(基本上就是把官方教程翻译了一遍,呵呵:)) ...

  10. 设计一个字符串类String(C++练习题)

    要求:设计一个字符串类String,可以求字符串长度,可以连接两个串(如,s1=“计算机”,s2=“软件”,s1与s2连接得到“计算机软件”),并且重载“=”运算符进行字符串赋值,编写主程序实现:s1 ...