Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active August 7, 2025 15:47
Show Gist options
  • Save nickcernis/1c2a1c98a0660d4798d55b1999d52b4c to your computer and use it in GitHub Desktop.
Save nickcernis/1c2a1c98a0660d4798d55b1999d52b4c to your computer and use it in GitHub Desktop.

Revisions

  1. nickcernis revised this gist Aug 7, 2025. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions mariadb-brew-macos.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,15 @@

    Edit — best to first try:

    ```
    mariadb-secure-installation -u $(whoami)
    ```

    Original version here below in case the above does not work for you.

    ---


    Attempting `mysql -u root` fails with `Access denied for user 'root'@'localhost` immediately after doing `brew install mariadb` and starting mariadb with `brew services start mariadb`.

    To fix it (with MariaDB still running):
  2. nickcernis renamed this gist Jul 13, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. nickcernis created this gist Jul 13, 2020.
    9 changes: 9 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    Attempting `mysql -u root` fails with `Access denied for user 'root'@'localhost` immediately after doing `brew install mariadb` and starting mariadb with `brew services start mariadb`.

    To fix it (with MariaDB still running):

    1. `sudo mysql` then enter your Mac user password
    2. `ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword';` replacing `newrootpassword` with the password you wish to use for the MariaDB root user.
    3. Ctrl-C to exit mysql.

    You should then be able to connect to MariaDB with `mysql -u root -p`, then entering the root password when prompted.