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 trialSarah Lehnert
9,405 PointsError connecting to Database server. Access denied for user root @ localhost. How do I reset the password?
- Just downloaded mysql community server and mysql workbench
- Followed along in the video (this is clearly an outdated video but you can follow along well enough)
- When connecting to the server i get error "Cannot connect to database server". access is denied for user root @ localhost (using password: YES).
- From lots of googling i think i need to reset the password
How do I reset the root password? (Mac latest OX)
1 Answer
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsHi.
Unfortunately I use Linux, so this instruction may not help.
Yet you can try it.
I had the same problem, and here is the post that solved all my problems
http://mysqladministrators.blogspot.de/2012/02/if-root-is-access-denied.html
There is suggested to run the following commands:
I. Stop Mysql.
/etc/init.d/mysql stop
As a note here, i should add, that if you won't probably have mysql
at /etc/init.d/mysql
, so judging from this post:
https://coolestguidesontheplanet.com/start-stop-mysql-from-the-command-line-terminal-osx-linux/
Try to executed this one
sudo /usr/local/mysql/support-files/mysql.server stop
II. Start Mysql Safe:
mysqld_safe --skip-grant-tables &
normally mysqld_safe
program should be on your $PATH, which means you can execute it just like that without a problems. If it is not, let me know. May be mysqld_safe
can be in /usr/local/mysql/bin/mysqld_safe
. This I can only guess from this post:
http://stackoverflow.com/questions/4780082/error-in-starting-mysql-in-mac-os-x-10-6
sudo /usr/local/mysql/bin/mysqld_safe -skip-grant-tables &
III. Start Mysql.
/etc/init.d/mysql start
Again you are on Mac so instead you probably should use :
sudo /usr/local/mysql/support-files/mysql.server start
IV. Login as root.
mysql -u root -p
This command on Mac again probably should be somewhat like, if simply typing mysql
won't work...
/usr/local/mysql/bin/mysql -u root -p
This last command asks you finally to RESET password to the one you like, and you finally be able to use MySQL server and Workbench properly
Sarah Lehnert
9,405 PointsSarah Lehnert
9,405 PointsI have tried those steps and some variations on those steps and its not working. I keep getting invalid command. Please help! This is so frustrating :(
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsAlexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsI'm sorry, yeah I know, I spend whole day digging how to do it ... Unfortunately It is very hard to help you remotely... The worst thing also that I have Linux, and not Mac ...
So if you have anyone that can help you locally, that would be the best solution...
I would you recommend you to remove MySQL and try to re-install it. Here for example instructions to remove MySQL i found
https://coolestguidesontheplanet.com/remove-mysql-from-macos-or-osx-via-the-command-line/
After doing that, install MySQL using following Guide on official MySQL page http://dev.mysql.com/doc/refman/5.7/en/osx-installation-pkg.html
According to it, at the step 7, temporary password will be shown
Try to follow those instructions, may be that will work. They look pretty straightforward to me ...
Of course you also can write me exactly what commands are you writing and its output, and we can try to debug where the problem is, but because Mac has such a nice GUI installator, I think you should to try to reinstall
Sarah Lehnert
9,405 PointsSarah Lehnert
9,405 PointsI appreciate all your help on this. It is really good to know that treehouse is so supportive. Unfortunately it still isnt working. I think when I first downloaded it, I copied the files to some other location and can't uninstall it completely. I think I am just going to have to sit down for a couple hours and figure this all out or maybe go to a tech night around here
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsAlexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsI understand...
But before you go, I wanted to advice you one more thing.
MySQL workbench is not the only tool around to create Databases.
Check out this site
http://alternativeto.net/software/mysql-workbench/
There plenty of SQL programs out there ... If I were you I would have tried others
For example I really like JetBrains company, and if I ever need database creation tool, I'm going to try 'DataGrip' solution.
It has 30-day trial, but still is a definitely a thing to try.
I know it will be a bit more complicated to follow the course, but still.
MySQL it is just a tool, nothing else. And if a tool does not work, you use another one that does.