The command:
mysql -u root -p
gives the error:
ERROR 1698 (28000): Access denied for user \'root\'@\'localhost\'
>
The error Message:
"ERROR 1698 (28000): Access denied for user 'root'@'localhost'"
means that the Server not allow the connect for this user and not that mysql cant access the socket.
try this to solve the problem:
Login in your DB
sudo mysql -u root -p
then make these modifications:
MariaDB []>use mysql;
MariaDB [mysql]>update user set plugin=' ' where User='root';
MariaDB [mysql]>flush privileges;
MariaDB [mysql]>exit
try login again without sudo