Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

altecdesign's avatar

Local Dev Setup: MariaDB Permission Issues

Whenever I setup a new or re-formatted Mac for development, I always follow the "Setting Up a Dev Machine from Scratch Tutorial" series which I really like. I've used it 5/6 times now in the last few years with no issues, but all of a sudden I'm running into a weird permissions issue with MariaDB not allowing me to create databases. It appears to think I'm logged into MySQL as an anonymous user even though running status from the MySQL command prompt shows me logged in as 'root'@'localhost'.

The console log from my issue as well as the output from running status is commented below. I also describe the issue in greater detail here:

https://stackoverflow.com/questions/60645558/homebrew-mariadb10-4-11-permission-issues-on-osx-catalina-10-15-3

I've tried deleting MariaDB and re-installing and didn't have any luck. Any help or ideas would be greatly appreciated, thanks!

➜  ~ mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.4.11-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> create database anything_db;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'anything_db'
MariaDB [(none)]> status
--------------
mysql  Ver 15.1 Distrib 10.4.11-MariaDB, for osx10.15 (x86_64) using readline 5.1

Connection id:		12
Current database:
Current user:		root@localhost
SSL:			Not in use
Current pager:		less
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.4.11-MariaDB Homebrew
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/tmp/mysql.sock
Uptime:			18 hours 5 min 23 sec

Threads: 7  Questions: 25  Slow queries: 0  Opens: 16  Flush tables: 1  Open tables: 10  Queries per second avg: 0.000
0 likes
2 replies
altecdesign's avatar

After trying a few different things and a re-install of Homebrew as well as MariaDB, I'm in a spot now where I get an access denied error (see below) when I try and login through iTerm/Terminal with mysql -uroot however using sudo mysql -uroot I can get in. I can run commands to create database after I login with the sudo prefix, however those DBs aren't accessible via any of my projects through usr/pwd validation through the .env file for Laravel and wp-config.php for Wordpress.

This leads me to believe its a permissions error and I need to somehow adjust the MariaDB/MySQL package so that my OS X user has permission to read/write/execute opposed to just root.

Just wanted to post an update, hopefully circling in on resolution...

➜  ~ mysql -uroot
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
altecdesign's avatar

When I login w/ the sudo prefix, I can print the Users Table w/ the plugin values for each user to show how they're being authenticated if that's helpful

MariaDB [(none)]> select User, Host, Plugin from mysql.user;
+---------+---------------------+-----------------------+
| User    | Host                | plugin                |
+---------+---------------------+-----------------------+
| root    | localhost           | unix_socket           |
| os_user | localhost           | mysql_native_password |
|         | localhost           |                       |
|         | usrnames-imac.local |                       |
+---------+---------------------+-----------------------+

Please or to participate in this conversation.