it's been 2 days and I still can't figure out why my I can't connect to MySQL on my command line. I am on a Mac and installed MySQL 8.0.17, Connect J 8.0.17 and Workbench 8.0.17. I need MySQL to complete my homework assignment which is to create a JDBC program that connects to the server. However, before I even started creating my program in Eclipse, I checked to make sure I could access MySQL server via cmd line (instructions from my professor) and it gives me this error message every time:

Kiaras-MBP:~ kiara$ /usr/local/mysql/bin/mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Sometimes it will give me this one: Kiaras-MBP:~ kiara$ /usr/local/mysql/bin/mysql -u root ERROR 1045 (28000): Access denied for user 'kiara'@'localhost' (using password: NO)

I reset the password like I've read in some of theses forums (-u root -p), I've accessed root using -skip-grant and so much more. I've uninstalled/reinstalled and deleted all of MySQL and Eclipse form my computer multiple times. What am I doing wrong? I am also very knew to coding and therefore I may be a bit slow in understanding.


Have a try with the following command:


If you have installed mysql trough app manager (not compiled from source), you need to initializate the DB/users/permissions.

During the mysql_secure_installation you can choose to delete or not delete the default table (used for test purpouse)

Have a look here for further information:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy