在centos中安装了mysql5.7之后解决不知道随机的密码的问题
2016-05-31 20:59
615 查看
在安装完成mysql5.7 之后,发现密码不知道。不要紧,直接重置密码。
1.修改配置文件my.cfg
[root@localhost ~]# vi /etc/my.cnf
找到mysqld在之后添加
skip-grant-tables
保存退出
2. 重启mysql服务
service mysqld restart
3.直接登陆mysql而不需要密码
mysql -u root (直接点击回车)
4.在mysql中输入
update mysql.user set password=password('root') where user='root';
(此时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list')
5.(这是怎么回事?)原来是mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
update
mysql.user set authentication_string=password('123456') where user='root' ;
6.执行flush
privileges
7.退出mysql
,到my.cgf中把开始添加的skip-grant-tables去掉
8.重启mysql服务
大功告成!
但是事实并非如此!
9.当你登陆mysql之后你会发现,当你执行命令时会出现
ERROR
1820 (HY000): You must reset your password using ALTER USER statement;
当你执行了SET PASSWORD
= PASSWORD('123456');
出现:ERROR
1819 (HY000): Your password does not satisfy the current policy requirements
10.你需要执行两个参数来把mysql默认的密码强度的取消了才行
1.修改配置文件my.cfg
[root@localhost ~]# vi /etc/my.cnf
找到mysqld在之后添加
skip-grant-tables
保存退出
2. 重启mysql服务
service mysqld restart
3.直接登陆mysql而不需要密码
mysql -u root (直接点击回车)
4.在mysql中输入
update mysql.user set password=password('root') where user='root';
(此时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list')
5.(这是怎么回事?)原来是mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
update
mysql.user set authentication_string=password('123456') where user='root' ;
6.执行flush
privileges
7.退出mysql
,到my.cgf中把开始添加的skip-grant-tables去掉
8.重启mysql服务
大功告成!
但是事实并非如此!
9.当你登陆mysql之后你会发现,当你执行命令时会出现
ERROR
1820 (HY000): You must reset your password using ALTER USER statement;
当你执行了SET PASSWORD
= PASSWORD('123456');
出现:ERROR
1819 (HY000): Your password does not satisfy the current policy requirements
10.你需要执行两个参数来把mysql默认的密码强度的取消了才行
set global validate_password_policy=0;
set global validate_password_mixed_case_count=2;
11这是你在执行
SET PASSWORD = PASSWORD('123456');
相关文章推荐
- linux中的‘make’和‘makefile’
- 最新版scala2.11.8与spark1.6.1一步到位安装
- linux与windows文件共享及全屏
- LINUX实践--ELF分析
- Linux的task_struct
- CentOS 命令随笔
- linux内核编译与卸载
- linux ps命令介绍
- Robert Love 在 quora 上关于 Linux Kernel 的问答摘录之一
- linux修改用户名
- Linux 之Makefile文件
- ant安装(linux)
- linux进程通信--信号量
- linux搭建zookeeper集群
- #码神学习#第三天
- Linux 进程描述符 task struct
- Linux下的进度条小程序
- linux环境搭建dubbo+zookeeper
- 【linux】find命令详解
- ubuntu永久修改主机名