Let me start by saying that i've looked through tons of posts (both here and elsewere on the internet) about resetting the mysql password, but nothing seems to work for me. Oh, i'm also fairly new to working on the command line.
Last week i updated my osx to Yosemite and when i tried to update the Apache settings today i noticed i couldn't connect to MySQL anymore. Before the update everything was working fine (MySQL had a password, which i knew and worked), so i have no idea what happened. The strange thing is that i updated another (older) laptop to Yosemite as well and on that one MySQL works fine now.
When i open phpmyadmin i can't login. The saved password (from before the update, which worked on Mavericks) doesn't seem to work anymore.
Below what i tried on the command line (with and without first starting/stopping MySQL (in safe mode)):
mysql root
#Gives me: ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'root'
mysql -u root
#Gives me: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
mysql -u root -p
#Gives me: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I can use the mysql command, which gets me
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Trying to update the password here gets me the following
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
ERROR 1142 (42000): UPDATE command denied to user ''@'localhost' for table 'user'
mysql>
I really hope someone knows what could be the problem, because i'm out of options
I used this article as a reference for updating the Apache settings
Edit: Additional information after Tata's comment
That comment gives me -bash: /etc/init.d/mysqld: No such file or directory.
Also sudo mysqld_safe --skip-grant-tables gives me:
141102 18:11:26 mysqld_safe Logging to '/usr/local/mysql/data/Maurices-MacBook-Pro.local.err'.
141102 18:11:26 mysqld_safe A mysqld process already exists
After that, i still can't do anything.
Unfortunately i don't know where to find the mysql init script and what to modify.
Solution
I've found a solution via serverfault. I forgot that i've added an com.mysql.mysql.plist file that i loaded via launchctl on startup to autostart MySQL on startup. First doing a sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysql.plist stopped MySQL and let me login in safe mode.