Mysql_secure_installation accept not the normal root password

Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysql/mysql.sock’ (2)
Enter current password for root (enter for none):

As already pointed out in the other thread: This is NOT the root pwd from your box but a new „root“ pwd which you gave for mysql/mariadb.

Sorry I had to start mariadb
But now I get ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
Enter current password for root (enter for none):

It is a total new installation root should not have a password

I am getting frustrated why I get an error after a default install.
mysql_secure_installation
I haven’t set the root password
But keep getting
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
Any ideas need help with this.

Do

mysqladmin -u root password 'YOUR_NEW_DATABASE_ROOT_PASSWORD'

Beware: This will only work on the machine where your database is installed.

When the command given above succeeds you should be able to login to your database with

mysql -u root -p

Thank you !

sorry does not work

mysqladmin -u root password 'YOUR_NEW_DATABASE_ROOT_PASSWORD' 
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Sorry i do not now why it is so hard. Does not work either.

Got it working

Mariadb changed its authentication methods four years ago; there is a summary of the available methods on the Bradford Linux Users Group website.
In simple terms, you do not have to set up any authentication for an ordinary user under Linux but, to run mariadb-secure-installation, you have to su or sudo into root. When you run it, accept all the prompts.
Add your databases using the source command (I assume you have a backup of your databases) and then grant permissions to any ordinary users (because of the change in the way permissions are handled, any permissions saved with your old databases will no longer work).
If you do not want to have mariadb accessible to anyone who has your root password, before you quit, enter
alter user root@localhost identified via mysql_native_password using password (“**********”);
and choose a different password where the asterisks are.
Don’t try to use any other of the possible authentication methods unless you already have them set up on your system.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.