(After two hours of researching how to use mysql commands in the terminal, I can finally post this question, BTW if anyone with macOS is having the same trouble that can't use mysql commands in the terminal, go straight to this straight to this link: solution.)
I have a Mac os Sierra, I'm completely new to MySQL. I first downloaded the workbench and the MySql server, it gave me a temp password, I created a local connection, it worked. Then, I deleted the old connection, and created another connection, it asks for the password, and it wouldn't work, so right now I'm trying to reset and change my mysql password, but I've been having a lot of trouble with it.
Since the SQL office website only has instructions for windows and unix, and I'm rather new to bash, I tried to find solutions somewhere else like this site.
1. Attempt
When I tried the solution from this link site1, as I try the first step, it asks for a password which I don't have, I tried the old password just to try and it didn't work.
YupengdeMacBook-Pro:~ yinyupeng$ sudo /usr/local/mysql/support-files/mysql.server stop
Password:
Then, I realized that I can close my server directly in the MacOS setting, I did that, and I jumped to the second step directly, it still asks for a password:
YupengdeMacBook-Pro:~ yinyupeng$ sudo mysqld_safe --skip-grant-tables
Password:
So I'm stuck here, can't go further with this solution.
2. Attempt
then I tried this site2, but as I type the first line, it tells me this:
YupengdeMacBook-Pro:~ yinyupeng$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Umm... ok, so then I tried to find solutions for that "access denied" error, but with little results.
So I'm not sure what to do now, please help, thank you very much. BTW, my SQL version is:
YupengdeMacBook-Pro:~ yinyupeng$ mysql --version
mysql Ver 14.14 Distrib 5.7.19, for macos10.12 (x86_64) using EditLine wrapper
YupengdeMacBook-Pro:~ yinyupeng$