MacOS Mojave - brew install mysql@5.7 - Access denied for user 'root'@'localhost'

brew uninstall mysql
brew install mysql 8
mysql access denied for user
formula `mysql` is not installed.
access denied for user root localhost macos
install mysql mac terminal
homebrew mysql access denied for user 'root'@'localhost
start mysql server mac mojave

When installing mysql via homebrew (i.e. brew install mysql@5.7) on MacOS Mojave, a seemingly succesful installation prints the following instructions:

We've installed your MySQL database without a root password. To secure it run:

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

When mysql -uroot, or mysql_secure_installation is run, I get the following error:

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

How can I login to mysql to change the password for root?

It seems that using an "empty string" password via the --password flag solves this problem:

mysql -uroot --password=""

Alternatively, you can manually start mysqld with --skip-grant-tables:

$ mysql.server --skip-grant-tables
$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24 Homebrew

Copyright (c) 2000, 2018, 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

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


And finally change the password with:

mysqladmin -uroot --password="" password NEW_PASSWORD

Can't connect to MySQL using instructions · Issue #10503 , homebrew mysql access denied for user 'root'@'localhost. When installing mysql via homebrew (i.e. brew install mysql@5.7 ) on MacOS Mojave, a seemingly  I used two approaches to install MySQL: brew and the offical installer. Brew: I started with brew install mysql. This installed the latest version of MySQL. It initially worked and I could log into the root user without a password. When I tried to set the password for the root account I ended up being locked out of the root account.

After a new brew mysql install:

1) Make sure that mysql is running: brew services start mysql

2) Change mysql password: mysqladmin -uroot --password="" password 'NEWPASSWORD'

3) Secure mysql: mysql_secure_installation (using new password)

Install MySQL 5.7 on macOS using Homebrew · GitHub, Tejass-MacBook-Pro:presto tejas$ brew install mysql Downloading https://​ Already tejas$ mysql -uroot ERROR 1045 (28000): Access denied for user  I installed MySQL 5.7 using homebrew: brew install mysql@5.7 As I understand, I am supposed to find mysql in /usr/local or /usr/local/bin but I see that mysql@5.7 was placed in /usr/local/opt. O

I think all people running the mysql_secure_installation command after installation would get into this trouble.

We need to append the username and password parameters to get thought this:

mysql_secure_installation -u root --password=""

brew install mysql@5.7 can't connect to local MySQL , To install MySQL enter : $ brew install mysql@5.7 try this:​/@at0dd/install-mysql-5-7-on-mac-os-mojave-cd07ec936034. Copy link If that didnt work, the next step is user privaledges for remote access Enter the following command : $ brew info mysql@5.7; Expected output: mysql@5.7: stable 5.7.22 (bottled) [keg-only] To install MySQL enter : $ brew install mysql@5.7. Additional configuration Homebrew. Install brew services first : $ brew tap homebrew/services. Load and start the MySQL service : $ brew services start mysql@5.7. Expected output : Successfully started mysql (label: homebrew.mxcl.mysql) Check of the MySQL service has been loaded : $ brew services list 1. Force link 5.7 version

Brand new install of 5.7.10 on Mac OS X - ERROR , You probably have some directories left from another mysql installation, that were not removed. I solved this by doing the following: First uninstall mysql brew  I've tried every single variant of this you can imagine and literally nothing will let me get in to reset the mysql root password, in spite of the fact that it's localhost only and I carefully noted the password I chose (I have also uninstalled & reinstalled at least six times with different passwords and even tried a Brew install with NO password -- I'm on Mac Mojave and trying to get MySQL

week 23, 2019, Re: Brand new install of 5.7.10 on Mac OS X - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO). install homebrew in Mac OSX 10.14.2 Mojave. Tagged with mac, install, homebrew.

mysql: MacOS Mojave - brew install mysql@5.7, But I got an error: "ERROR 1698 (28000): Access denied for user 'root'@'​localhost'". After some Googling I learnt that the security model in MySQL 5.7 has a clean install of macOS Mojave on the fusion drive of my Mac mini  Native Package Installer, which uses the native macOS installer (DMG) to walk you through the installation of MySQL. For more information, see Chapter 2, Installing MySQL on macOS Using Native Packages.

  • I am not sure how the default mysql password was set to "", but if others upvote this post (proving reproducibility), I will open a Pull Request against homebrew to try and fix this, or at least update the homebrew "Caveats" to include the "--password=''"