Use MariaDB and MySQL without Password (MySQL Backup)

Posted on January 9, 2021 at 1:40 pm

On older MySQL versions you could use:


To get MySQL username and password to use for backup purposes.

On newer MySQL v8+ versions you just need to run this command as root user:

mysql -u root -h localhost ...

Password is not required in this case.

This is because it uses unix_socket authentication as explained here:

To allow another Linux user to auto-connect to MySQL with full privileges:

GRANT ALL PRIVILEGES ON *.* TO 'vagrant'@'localhost' IDENTIFIED VIA unix_socket;

This works also on recent MariaDB versions.

Receive updates via email

Other Posts

Updated Posts