Mac MySql更改原始密碼
阿新 • • 發佈:2020-07-30
1.下載好mysql後,開啟終端
➜ tmp mysql -u root -p Enter password:
2.直接回車,進入mysql控制檯,設定新密碼
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('你的新密碼');
3.退出重進,直接回車不輸入密碼,提示密碼錯誤
➜ tmp mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
4.輸入剛剛設定的密碼,成功進入
➜ tmp mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 5.7.27 Homebrew Copyright (c) 2000, 2019, 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 -> ; +------------------------------+ | Database | +------------------------------+ | information_schema | | commerce_backend_development | | commerce_backend_production | | commerce_backend_test | | mysql | | performance_schema | | sys | +------------------------------+ 7 rows in set (0.01 sec)