MariaDB Permissions Issue

Running into an odd issue where after installing MariaDB package through Homebrew, any command I run is being interpreted as coming from ‘’@‘localhost’ (which I’m guessing is an anonymous user) so I can’t create a database, I receive a permission denied for ‘’@‘localhost’ error. However, from my the mysql prompt, running ‘status’ shows my user as ‘root’@‘localhost’.

More details here:

Any help is appreciated, thanks!

1 Like

Please copy and paste the exact command and error message.

Thanks for the quick reply, sure the iTerm log is below:

➜  ~ 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'

and as I mentioned if I run status I get this:

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


The MariaDB developers would likely be best suited to interpret this error message. Please do post back here if you’re able to resolve your issue. Good luck!

I posted in the MariaDB community area and if I get any answers I’ll post back. If you have any other ideas on a good spot to post let me know. I’ll report back if/when I get an answer, thanks!

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'

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 |                       |

You’re probably better off troubleshooting this issue on a MariaDB forum. You’ve also posted this thread to Homebrew on Linux, and it sounds like you’re using Homebrew on macOS.

Sorry I didn’t even realize that, problem has been driving me nuts so checked the wrong box in my rage haha. Meant to post in the general Homebrew forum. I won’t add to this anymore, thanks again for the advice to go to the MariaDB forums