Solved: Login to new mysql server by following command:
$ sudo mysql
MariaDB [(none)]> use mysql;
MariaDB [mysql]> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘password’;
MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> EXIT;
Now you can login with the following command:
$ mysql -u root -p
Enjoy.