Link to home
Start Free TrialLog in
Avatar of burnedfaceless
burnedfaceless

asked on

MariaDB won't secure root user with a password on Ubuntu 16.04

I am running Ubuntu 16.04. I wanted to switch MySQL with MariaDB first on my local machine then on my production environment.

I installed apt-get install mariadb-server. The installation completed without setting a root password.

I found whenever I typed in the commands sudo mysql, sudo mysql -u root it would load into MariaDB.

I ran mysql_secure_installation without sudo and it asked me for the root password (left blank if not configured) whenever I left it blank it would not allow me to continue, gave me access rejected and prompted me to try it again.

When I ran mysql_secure_installation with sudo it accepted a blank entry for root password and allowed me to configure the root password. I selected yes to every option I think including flush privileges.

After that mysql -u root -p would not accept the password I had set. I ran sudo service mysql restart and it still didn't work.

I found I could use sudo mysql -u root -p and enter any password and get into the MariaDB prompt.

I created another user that has privileges to one database and that user logs in with the correct password and rejects attempts from another password.

But root still will not load unless I am running it as sudo. I was thinking about holding off on putting this on my production environment until I have this issue resolved.
ASKER CERTIFIED SOLUTION
Avatar of A Q Choudary
A Q Choudary
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of burnedfaceless
burnedfaceless

ASKER

I'm asking how to protect the root user with a password rather than needing sudo to access mariadb
Thanks