0

I was following a Ruby on Rails tutorial (fairly new to this language) and suddenly started having some problems connecting with MySQL on my Mac. While doing the tutorial I believe I changed the shell location using similar steps in this guide, not sure if that’s important at all.

My $PATH returns:

-bash: /Users/[MYUSERNAME]/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin://usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

Anyway, I’ve been working through the tutorial and have been developing since then but I went to check my files a week or so later and suddenly cannot connect to MySQL at all, if I enter mysql -u root -p (then enter correct password as it always has been) I get:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I’ve got MySQL Workbench although I rarely use it, and I use the System Preferences App to start and stop my server. I also have MAMP which I was using a while ago but I haven’t used it since using RoR.

Strange thing is, this happened before and I couldn’t connect, I was searching around for ages trying to find a solution and (not sure what I did, probably nothing substantial) it started working again. But once again it’s happened and think it’s time I learnt what the problem is so I don’t keep running into it.

Personally, I think I should’ve learnt MySQL in more depth before blind-following a tutorial assuming it’d be fine.

Any help would be greatly appreciated, thanks!

Let me know if you need me to provide anything else.

  • check out the links here: http://stackoverflow.com/questions/641984/mysql-cant-access-root-account This is a common SO question. Lots of different suggested solutions out there. My suggestion: post your versions for literally everything: your OS, mysql itself, the mysql gem you're using, if any, etc. – toddmetheny Mar 16 '16 at 13:07
  • Thanks - I'll take a look and follow what's said and report back :-) – classequalsarthur Mar 16 '16 at 16:28

1 Answers1

0

Simple answer in the end, I followed this tutorial and was able to reset the root password and it fixed everything.