Cannot log in to the MySQL server
Login as root and grant access privileges to user
GRANT ALL PRIVILEGES ON dbname.* TO 'yourusername'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON dbname.* TO 'yourusername'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
restart mysql /mariadb service.
it will grant user with local as well as remote host(if you want).