解决在CentOS 7上重装MySQL 5.7.10后root账户无法登陆
来源:互联网 发布:网络心理咨询师招聘 编辑:程序博客网 时间:2024/04/30 00:08
1. Stop mysql:systemctl stop mysqld2. Set the mySQL environment option systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"3. Start mysql usig the options you just setsystemctl start mysqld4. Login as rootmysql -u root5. Update the root user password with these mysql commandsmysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword') -> WHERE User = 'root' AND Host = 'localhost';mysql> FLUSH PRIVILEGES;mysql> quit6. Stop mysqlsystemctl stop mysqld7. Unset the mySQL envitroment option so it starts normally next timesystemctl unset-environment MYSQLD_OPTS8. Start mysql normally:systemctl start mysqldTry to login using your new password:7. mysql -u root -p
----------------------------------------------------------
[root@localhost ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> UPDATE mysql.user SET authentication_string = PASSWORD('XXXXXX') WHERE User = 'root' AND Host = 'localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# systemctl unset-environment MYSQLD_OPTS
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -pXXXXXX
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 3
Server version: 5.7.16
Copyright (c) 2000, 2016, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXXXXX');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
0 0
- 解决在CentOS 7上重装MySQL 5.7.10后root账户无法登陆
- mysql root 无法在 linux 本地登陆
- CentOS自动更新到6.5后root无法登陆问题解决
- 解决dm3730自动登陆root账户
- [mysql]修复root无法登陆
- Ubuntu13.10 使用root账户登陆
- Fedora15默认无法用root账户登陆的解决方法
- 解决安装完ubuntu登陆无root账户问题
- 重装mysql后无法启动的问题
- CentOS中解决root用户无法登陆ftp传输文件的问题
- Centos上安装samba配置后,windows登陆root没有写权限
- mysql 更改root账户密码 - mysql-5.7.11-osx10.10
- 重装Windows和VMware后Ubuntu虚拟机无法登陆
- 重装谷歌浏览器后无法登陆,登陆后无法同步书签
- root android 设备 app卸载后无法重装的问题
- 如何处理vsftpd安装后,解决root账号ftp无法登陆的问题
- XAMPP3.2.2 Mysql root密码重置,同时解决PhpMyadmin在设置密码后无法登录的问题。
- CentOS6.4下安装MySQL5.6.10后root无法登陆MySQL
- 认知【STL】里的set和multise
- 使用DOS命令创建一个基于Maven的Web项目
- 点击listview的item,带动画效果的展开详情(二)
- 欢迎使用CSDN-markdown编辑器
- Python内建方法
- 解决在CentOS 7上重装MySQL 5.7.10后root账户无法登陆
- BinaryConnect: Training Deep Neural Networks with binary weights during propagations
- 移植qt到mips架构平台
- Projectioni Pursuit Regression
- 单链表的操作
- influxdb基本操作
- apply()与call()的区别和用法
- sql 随笔
- 12-判断星座