CentOS7安装MySQL初始密码设置:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
晕,找了好半天终于找到了,在这里做个笔记。
解决错误: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
$
以上命令依次为:
- 修改:密码最小长度策略
- 修改:密码强度检查等级策略,0/LOW、1/MEDIUM、2/STRONG
- 修改密码
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)
依次为:
- 开启mysql的root用户远程连接服务(%号即远程连接,IDENTIFIED BY后面跟的密码)
- 刷新
CentOS7安装MySQL初始密码设置:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:相关推荐
- 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) ...
- MYSQL重置密码遇到ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using passwor:yes)问题
一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...
- 重置密码解决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 ...
- 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 ...
- 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] ...
- windows 下 安装mysql 出现 “ ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password
这个问题是在Windows下安装MySQL服务时遇到的,使用MySQl绿色版进行安装的,安装完成后,连接到MySQL服务时输入命令 " mysql -uroot -p " ,因为时 ...
- Linux上重置MySQL密码 错误 ERROR 1045 (28000): Access denied for user ‘‘root‘‘@‘‘localhost‘‘ (using passw...
最近在服务器上安装了一个MySQL,在初始化密码之后,发现密码太复杂我每次都输错了,然后就出现了,ERROR 1045 (28000): Access denied for user ''root'' ...
- ubuntu安装mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES
通过apt安装方法十分简单,而且这种安装方法安装的mysql版本都是当前最新的版本.这种方式安装好后开机自启动都已经配置好,包括命令行的环境变量,无需手动配置. 如果出现以下问题 ERROR 1045 ...
- 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 ...
最新文章
- linux shell 字符串 数组,bash shell函数返回数组字符串
- asp.net webapi 自托管插件式服务(转)
- 如何区分网线是几类的_小移课堂 | 网线这样选,网速才能嗖嗖的!
- image pil 图像保存_使用PIL保存图像
- macos big sur u盘安装_老款macbook机型欺骗补丁强制安装macOS11 Big Sur图文详解
- java url 短链接_推荐几个官方腾讯短链接url接口(含PHP演示代码)
- 补习系列(8)-springboot 单元测试之道
- c 找不到mysql.h_Linux下C连接MySQL找不到MySQL.H的问题
- 吐血整理!顶级程序员的百宝箱来咯!| 原力计划
- .NET Framework 3.5 SP1的图表控件——Chart (转)
- Range.EntireRow Property
- CSS中transform:skew属性理解
- php算法结构,PHP中常用算法以及数据结构
- nginx启动vue_Docker部署前端Vue
- Eclipse- 使用记录(1)
- Android6.0动态壁纸,全局透明动态壁纸
- [译文]优雅的现代JavaScript设计模式: 冰冻工厂
- OM | 浅谈收益管理与动态定价
- 表格固定表头,tbody加滚动条
- 如何判断手机浏览器是否有安全隐患?