Lo1176
Lo1176

Reputation: 49

mariadb-secure-installation (Ver15.1) ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I'm following this tutorial to install mariadb on macOs Mojave. And I'm still have an issue when I try to secure it with mariadb-secure-installation

touch: .my.cnf.16016: Permission denied
touch: .mysql.16016: Permission denied
chmod: .my.cnf.16016: No such file or directory
chmod: .mysql.16016: No such file or directory

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
/usr/local/bin/mariadb-secure-installation: line 249: .my.cnf.16016: Permission denied
/usr/local/bin/mariadb-secure-installation: line 250: .my.cnf.16016: Permission denied
/usr/local/bin/mariadb-secure-installation: line 251: .my.cnf.16016: Permission denied
/usr/local/bin/mariadb-secure-installation: line 253: .my.cnf.16016: Permission denied
/usr/local/bin/mariadb-secure-installation: line 218: .mysql.16016: Permission denied
/usr/local/bin/mariadb-secure-installation: line 220: .mysql.16016: No such file or directory
Enter current password for root (enter for none): 

I've tryed this without success:

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD('my_secret_password');

When I do mysql.server status I've got

 ERROR! MariaDB is running but PID file could not be found

Somebody could help me on this please :) šŸ™

Do I have to cleanup mysql ? šŸ§

Upvotes: 0

Views: 3009

Answers (1)

Lo1176
Lo1176

Reputation: 49

I solved this error with the Noahmay's suggestion (sudo mariadb-secure-installation)

So I first started mySql server:

mysql.server start 
Starting MariaDB
 SUCCESS!

Then I setup a new password with mysql_native_password. Honestly I don't really know if it is necessary.

āžœ  ~ mariadb

MariaDB [(none)]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
Query OK, 0 rows affected (0.012 sec)

MariaDB [(none)]> SET PASSWORD = PASSWORD('put_your_password_here');
Query OK, 0 rows affected (0.009 sec)

MariaDB [(none)]> exit
Bye

Then you can put this magic line and finish to secure MariaDB

āžœ  ~ sudo mariadb-secure-installation

I hope it will help macOs users.

Upvotes: 2

Related Questions