本文主要是介绍mac下安装完毕mysql5.7后修改密码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
mac环境下,5.7修改密码
1.安装后记住一下密码
2020-12-28T06:32:22.601906Z 1 [Note] A temporary password is generated for root@localhost: ;dh(d83BJo:kIf you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
2.打开系统偏好设置,开启mysql服务,默认安装完毕是stop的
3.进入到安装的目录下,修改密码
➜ ~ /usr/local/mysql-5.7.20-macos10.12-x86_64/bin
➜ bin ./mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20 MySQL Community Server (GPL)Copyright (c) 2000, 2017, 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>SET PASSWORD = PASSWORD('jianan');
===============
1) MYSQL5.7以下版本
数据库密码使用的是
mysql这个数据库里的user表的password这个字段,
修改密码只需:
update MySQL.user set password=password('root') where user='root' ;
flush privileges;
2)可是到了5.7版本,user表里就没有了password这个字段了
要想修改密码则需要用authentication_string这个字段:
update MySQL.user set authentication_string=password('jianan') where user='root';flush privileges;
这篇关于mac下安装完毕mysql5.7后修改密码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!