error 1045, access denied for user 'zoe'@'localhost' (using password: no)

I downloaded MySQL 5.6.* following this instruction. However, after I finished when I used command mysql -v to check the download, I got this error: ERROR 1045 (28000): Access denied for user ‘zoe’@‘localhost’ (using password: NO). Can anyone please help me with this?

I face same problem use this step to fix it

  1. Open & Edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distro.
  2. Add skip-grant-tables under [mysqld]
  3. Restart Mysql
  4. You should be able to login to mysql now using the below command mysql -u root -p
  5. Run mysql> flush privileges;
  6. Set new password by ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘NewPassword’;
  7. Go back to /etc/my.cnf and remove/comment skip-grant-tables
  8. Restart Mysql
  9. Now you will be able to login with the new password mysql -u root -p

Thank you! I did not see the my.cnf file in my files. Should I open /etc/my.cnf or /etc/mysql/my.cnf on my browser?

which operating system are you running,are you able to access a mysql terminal??

Note that mysql -v is actually the flag to run the MySQL client in verbose mode. By default, the MySQL client will try to log you in to the locally running server, either over port 3306 (on Windows) or through the configured MySQL socket on Linux and macOS using your current login name as the user name.

If you just want to check the version of MySQL you have installed, you need to run either mysql -V or mysql --version.

PS The error message you got at least indicates that there is a MySQL server running locally on your machine that was able to connect to.

I am running on Ubuntu 20.04. I am not sure how to test if I can access mysql terminal. Thank you!

Thank you! Does that mean I have downloaded mysql 5.6.* successfully? Is it adequate for deploying the code if I get this error?

You probably want to run through the steps @roshanthapa outlined above so that you actually know the root password for the install, because that’s necessary to setup OpenMRS.

Alternatively, you could follow the steps outlined here, although I would note the PID output when running the mysqld_safe --skip-grant-tables & and run kill <PID> before running service mysql restart.

Thank you! I get errors while running command mysqld_safe --skip-grant-tables and these are the errors https://pastebin.com/4fm0p9v9. I am not sure how to access /etc/my.cnf or /etc/mysql/my.cnf for solution provided by@roshanthapa.

I opened /etc/mysql/my.cnf and the result is here https://pastebin.com/zx506C49, but where should I add skip-grant-table?

Right at the end of the file

I have added to the end of the file, but it shows me that the file is read-only. Here are the screenshots of the edited file and the error occured.