I had the same issue. Here are the steps to solve it.
1 . Stop mysql service
service mysql stop
2 . Start to MySQL server w/o password:
use mysqld_safe:
mysqld_safe --skip-grant-tables &
Output:
170403 17:38:46 mysqld_safe Logging to '/var/lib/mysql/domain.com.err'.
170403 17:38:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
3 . Connect to mysql server using mysql client:
# mysql -u root
Output:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.0.30-MariaDB-0+deb8u1 (Debian)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
4 . Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("**NEW-ROOT-PASSWORD**") where User='root';
mysql> flush privileges;
mysql> quit
5 . Start MySQL server and test it:
service mysql start
mysql -u root -p