Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations Installing MySQL Server and MySQL Workbench Installing MySQL Server and Workbench on OS X

Derek Derek
Derek Derek
8,744 Points

MySQL workbench - cannot connect to Database server

I followed the video step by step (since the version I downloaded is very different, I followed the directions given here: https://kyledamken.wordpress.com/2014/12/28/new-terms-from-treehouse-database-foundations-part-1-introduction-to-data-databases-and-sql-installing-mysql-server-and-mysql-workbench-reading-data-from-databases-with-sql-and-creatin/#install

However, I cannot connect to Database server at step 7. It fails all three, and I get this error:

Your connection attempt failed for user 'root' from your host to server at localhost:3306: Access denied for user 'root'@'localhost' (using password: YES)

Please: 1 Check that mysql is running on server localhost 2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed) 3 Check the root has rights to connect to localhost from your address (mysql rights define what clients can connect to the server and from which machines) 4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host address you're connecting from

I tried googling, but I could not resolve it. For some reason, if I try to type mysql commands in Terminal, it complains -bash: mysql: command not found. What can I do to connect to the server and also how can I use MySQL commands on the terminal? I am a Mac user and I have downloaded MAMP by following one of the videos in the PHP library. Until yesterday. MAMP worked, and suddenly it is not working..

2 Answers

Kevin D
Kevin D
8,646 Points

This doesn't answer your initial problem...but for your second problem: "if I try to type mysql commands in Terminal, it complains -bash: mysql: command not found."

You might have to go inside mySQL first in Terminal; like this:

mysql -u dbUserName -p

When you press enter, you type your DB password and then Terminal will show this on the new line:

mysql>

Once this happens, you can then start typing in the SQL commands. To exit out of this 'mode', press: CTRL + C

Derek Derek
Derek Derek
8,744 Points

Again, it says, -bash: mysql: command not found. I just can't input a command that starts with the word "mysql"..

Timothy Boland
Timothy Boland
18,237 Points

seems like its a bug....on the latest version of mysql workbench, if you just click on the server instance again to start it up, it will prompt you to reset your password, but of course, you will need to have the original temporary password it gave you....so if you dont remember it...you will have to uninstall everything and reinstall and make sure you keep your original temporary password