If you have just installed mariadb, you should run this command in order to set a password for the root user and secure your installation:
$ sudo mysql_secure_installation
Besides asking you to provide the new root password, this utility will help you to remove anonymous user (created by default, intended for testing), disallow root login remotely (root should only be allowed to connect from ‘localhost’), remove test database and privileges ad reloading the privilege table. All of it just pressing the Enter key a couple of times 🙂 Not bad!
If that process doesn’t work, try this other one:
(using sudo, don’t specify any password)
$ sudo mysql -u root
Create a new database:
CREATE DATABASE yourdb;
Grant privileges to a new user:
GRANT ALL ON yourdb.* TO yournewuser@localhost IDENTIFIED BY 'yourpassword'; FLUSH privileges;
my homebrew installed Mariadb wouldnt accept blank for theroot password, so I tried your command-line above but it fsiled for the same reason I’ve got a fresh install thats inaccessible!!?
Remember to use sudo when starting the secure install. I had the same problem and using sudo solved the issue
Dena untsa mariadbarekin. «Ikasten.io» deitzen da beraz, euskaldun bat hiz uste dutela !
Agur iparraldetik.