晕,找了好半天终于找到了,在这里做个笔记。

解决错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Table of Contents

1.安装

2.查找初始密码

3.密码修改

4.其他设置


感谢:CentOs安装Mysql和配置初始密码

1.安装

首先使用yum安装MySQL就不用过多说明了。

2.查找初始密码

查找方式:

$ grep 'temporary pass' /var/log/mysqld.log
2018-02-04T06:08:19.158928Z 1 [Note] A temporary password is generated for root@localhost: l#()FqWfy9ih

这里注意,我的密码里带有()括号,那么这样用就不对了

$ mysql -uroot -pl#()FqWfy9ih
bash: 未预期的符号 `(' 附近有语法错误

需要这样用:

$ mysql -uroot -pl#\(\)FqWfy9ih
mysql: [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 31
Server version: 5.7.24Copyright (c) 2000, 2018, 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> 

成功进入MySQL的命令行。

3.密码修改

mysql> set password for 'root'@'localhost' = password('root');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set global validate_password_length=0;
Query OK, 0 rows affected (0.00 sec)mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)mysql>  set password for 'root'@'localhost' = password('root ');
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> exit
Bye
$ 

以上命令依次为:

  1. 修改:密码最小长度策略
  2. 修改:密码强度检查等级策略,0/LOW、1/MEDIUM、2/STRONG
  3. 修改密码

4.其他设置

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root ' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

依次为:

  1. 开启mysql的root用户远程连接服务(%号即远程连接,IDENTIFIED BY后面跟的密码)
  2. 刷新

CentOS7安装MySQL初始密码设置:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:相关推荐

  1. mac使用mysql出现的错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    mac使用mysql出现的错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ...

  2. MYSQL重置密码遇到ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using passwor:yes)问题

    一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...

  3. 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor

    重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor ...

  4. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因...

    在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

  5. mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    [问题]: mysql版本:5.7.13 首次在centos下安装mysql,客户端连接mysql时报错: [plain]  view plain  copy [root@localhost opt] ...

  6. windows 下 安装mysql 出现 “ ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password

    这个问题是在Windows下安装MySQL服务时遇到的,使用MySQl绿色版进行安装的,安装完成后,连接到MySQL服务时输入命令 " mysql -uroot -p " ,因为时 ...

  7. Linux上重置MySQL密码 错误 ERROR 1045 (28000): Access denied for user ‘‘root‘‘@‘‘localhost‘‘ (using passw...

    最近在服务器上安装了一个MySQL,在初始化密码之后,发现密码太复杂我每次都输错了,然后就出现了,ERROR 1045 (28000): Access denied for user ''root'' ...

  8. ubuntu安装mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES

    通过apt安装方法十分简单,而且这种安装方法安装的mysql版本都是当前最新的版本.这种方式安装好后开机自启动都已经配置好,包括命令行的环境变量,无需手动配置. 如果出现以下问题 ERROR 1045 ...

  9. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (usin

    Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pass... 时间 201 ...

最新文章

  1. linux shell 字符串 数组,bash shell函数返回数组字符串
  2. asp.net webapi 自托管插件式服务(转)
  3. 如何区分网线是几类的_小移课堂 | 网线这样选,网速才能嗖嗖的!
  4. image pil 图像保存_使用PIL保存图像
  5. macos big sur u盘安装_老款macbook机型欺骗补丁强制安装macOS11 Big Sur图文详解
  6. java url 短链接_推荐几个官方腾讯短链接url接口(含PHP演示代码)
  7. 补习系列(8)-springboot 单元测试之道
  8. c 找不到mysql.h_Linux下C连接MySQL找不到MySQL.H的问题
  9. 吐血整理!顶级程序员的百宝箱来咯!| 原力计划
  10. .NET Framework 3.5 SP1的图表控件——Chart (转)
  11. Range.EntireRow Property
  12. CSS中transform:skew属性理解
  13. php算法结构,PHP中常用算法以及数据结构
  14. nginx启动vue_Docker部署前端Vue
  15. Eclipse- 使用记录(1)
  16. Android6.0动态壁纸,全局透明动态壁纸
  17. [译文]优雅的现代JavaScript设计模式: 冰冻工厂
  18. OM | 浅谈收益管理与动态定价
  19. 表格固定表头,tbody加滚动条
  20. 如何判断手机浏览器是否有安全隐患?

热门文章

  1. MySQL8 全部类型
  2. 2019.08.30数组去重的几种方法以及所需时间对比
  3. js将long日期格式转换为标准日期格式
  4. Maven发布web项目到tomcat
  5. 17110 Divisible(basic)
  6. 【Windows phone 8】欢迎引导页面01
  7. mysql和mysqli的区别
  8. Spring mvc介绍
  9. xadmin获取mysql_Django+Xadmin构建项目的方法步骤
  10. 软件工程 选课系统的uml类图_想成为高级程序猿,面向对象建模和UML你不应该知道?...