After fresh install of mysql-server, can't log in with `mysql root -u`

1) you can try to reconfigure the mysql-server :

sudo dpkg-reconfigure mysql-server

2) check if you have the debian-sys-maint passwd

cat /etc/mysql/debian.cnf

and check for :

user     = debian-sys-maint
password = xxxxGx0fSQxxGa

debian-sys-maint has all privileges on the mysql server

3) if it do not solve the problem, you can reset the passwd :

sudo service mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("NewPasswd") where User='root';
mysql> flush privileges;
mysql> quit

sudo service mysql stop
sudo service mysql start
mysql -u root -p