1

I am new to MySQL.

I installed MySQL through dmg file downloaded from oracle in mac. I created my first connection also but now whenever I am trying to connect it again it not allowing me.

I read over internet that I need to ALTER root password. So I tried many ways of doing it but either it says UPDATE Command not found or Access denied to root@localhost...

Can someone please suggest a solution?

1

My issue got resolved using the information in URL below:

https://vladster.net/en/instructions/install-mysql-mac/

Steps taken:

  1. Changed to MySQL directory:
    cd /usr/local/mysql
  2. Since my initial root password was expired and was not able to connect to root, so ran the installation again:
    sudo bin/mysql_secure_installation
  3. After providing machine password it automatically asked for new root password.

Above steps resolved my issue.

0
0

First, do have the existing root password? And you are logged in to an account with administrator access on the Mac? On many Mac installs root is disabled by default. Here are some things to try and see what is the status of your install:

  1. Your administrator user does have a password, correct? Running commands in terminal often fail if the administrator account does not have a password. If you don't have one, then add it.
  2. Can you execute an sudo -s xxxx command (where xxxx is the command you want to execute) and run the command as root? If you can then use sudo -s to run commands in Terminal for MySQL. (see: https://apple.stackexchange.com/questions/14421/how-do-i-run-terminal-in-sudo-mode.)

    These 2 steps may resolve your problem. If not:

  3. At the mysql> prompt run UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root'; In MySQL 5.7 the Password parameter is now set with Authentication_String.
    While Apple recommends not using the root user, MySQL usually demands it.

2
  • Thanks for prompt reply. I tried the options which you mentioned. Step 1: I have admin password for mac. 2. I executed the commands using sudo but it gave "/bin/bash: mysqladmin: command not found" error. And for Step 3 I do not see mysql prompt.
    – Sachin B
    Oct 8 '17 at 10:50
  • If you are comfortable with Linux/Unix, then I would enable root and then set the root password and work from there. (Comfortable because the wrong command can wipe out everything. If you do not have experience, it's not recommended.) Secondly, have you tried to 'cd' to mysql? You may have to use an 'ls' command (that's LS in lower case) to find the mysql directory. That will give you the mysql prompt. Once you're in that directory then Step 3 should work. Oct 9 '17 at 9:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.