Error description
[error] failed to initialize database, got error Error 1698: Access denied for user 'root'@'localhost' 2022/09/02 08:49:01 Error 1698: Access denied for user 'root'@'localhost' panic: database link failed
Problem resolution
1. Clear the password of the root user
sudo mysql -u root use mysql; update user set plugin='' where User='root'; flush privileges; exit;
2. Set the global password
sudo mysql -u root ---Set password to log in grant all privileges on *.* to 'root'@'%' identified by 'mysql_native_password with grant option; or run mysql: UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket'; flush privileges; exit;
mysql/mariadb needs to be restarted:
sudo service mysql restart