RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
mysql8.0忘记登录密码怎么办

MySQL8.0忘记登录密码怎么办?针对这个问题,今天小编总结这篇有关找回密码的文章,希望帮助更多想解决这个问题的同学找到更加简单易行的办法。

成都创新互联公司是一家专注于成都做网站、网站设计、外贸营销网站建设与策划设计,丰县网站建设哪家好?成都创新互联公司做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:丰县等地区。丰县做网站价格咨询:18980820575

pkill mysqld 关闭掉mysql

跳过MySQL的权限表启动MySQL服务:
--skip-grant-tables启动mysql

/usr/local/mysql8013/bin/mysqld_safe --defaults-file=/data/mysql8/my8.cnf --skip-grant-tables & 

将密码置空:

root@localhost [(none)]>update mysql.user set authentication_string='' where user="root" and host="localhost";
Query OK, 1 row affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

root@localhost [(none)]>

pkill mysqld 关闭掉mysql

再次启动mysql服务

[root@localhost ~]# /usr/local/mysql8013/bin/mysqld --defaults-file=/data/mysql8/my8.cnf &

无密码登录MySQL服务并设置新的密码:

root@localhost [(none)]>select version();
+-----------+
| version() |
+-----------+
| 8.0.13    |
+-----------+
root@localhost [(none)]>alter user user() identified by 'jist558@wei';

[root@localhost ~]# mysql -uroot -p'jist558@wei' -e "select version();"
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------+
| version() |
+-----------+
| 8.0.13    |
+-----------+

密码写入.my.cnf文件就可以mysql直接登录mysql窗口:

[root@localhost ~]# cat .my.cnf 
[mysql]
prompt="\u@\h:\p \R:\m:\s[\d]>"
no-auto-rehash
user=root
password=jist558@wei
[root@localhost ~]# mysql -e "select version();"
+-----------+
| version() |
+-----------+
| 8.0.13    |
+-----------+

关于mysql8.0忘记登录密码解决办法就分享到这里了,解决问题并不止文章中和大家分析的办法,不过本文分析的方法准确性是不容置疑的。更多相关内容欢迎关注创新互联行业资讯频道。


名称栏目:mysql8.0忘记登录密码怎么办
转载注明:http://scyingshan.cn/article/ipdccg.html