【引自豆花饭烧土豆的博客】封闭正在运行的 MySQL :
运行
- [root@www.woai.it ~]# mysqld_safe --skip-grant-tables &
为了安然可以如许禁止长途连接:
- [root@www.woai.it ~]# mysqld_safe --skip-grant-tables --skip-networking &
应用mysql连接server:
- [root@www.woai.it ~]# mysql -p
- mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
而是将加密后的用户暗码存储于authentication_string字段
在
更改暗码:
- mysql> flush privileges;
- mysql> quit;
修改完毕。重启
- [root@localhost ~]# service mysql restart
然后mysql就可以连接了
但此时操作似乎功能不完全,还要alter user…
- mysql> alter user 'root'@'localhost' identified by '123';
如许也可以:
- mysql> set password for 'root'@'localhost'=password('123');
- mysqladmin: [Warning] Using a password on the command line interface can be insecure.
- Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
重点给大年夜家介绍下mysql 5.7 root暗码修改
MySQL治理者暗码设置或修改:
根据官方解释5.6今后版本,第一次启动时会在root目次下临盆一个随机暗码,文件名.mysql_secret。
- [root@bright ~]# cat /root/.mysql_secret
- # Password set for user 'root@localhost' at 2015-03-27 23:12:10
- :Jj+FTiqvyrF
- [root@bright ~]# cd /usr/local/mysql/bin/
- [root@bright bin]# ./mysqladmin -u root -h localhost
推荐阅读
作者:邓凯“他们须要大年夜数据中找到有效的┞锋相,然后解释给引导者。” – Rchard Snee Emc今天这个标题有点大年夜,内容可能涉及的比较多,但也是数据君多年来一向想>>>详细阅读
本文标题:Mysql5.7忘记root密码及mysql5.7修改root密码的方法
地址:http://www.17bianji.com/lsqh/34772.html
1/2 1