Access denied for user 'root'@'localhost' while installing erpnext in ubuntu 18.0.4

Hi @everyone
I’m installing ERPnext/frappe on ubuntu 18.0.4, I followed this link

till creating new site everything is ok, but when I run command bench new-site erp.nawrooz.com I get the following error

bench@mmerp:~/erpnext$ bench new-site erp.nawrooz.com
MySQL root password:
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 34, in new_site
    verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 65, in _new_site
    admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)
  File "/opt/bench/erpnext/apps/frappe/frappe/installer.py", line 38, in install_db
    create_database_and_user(force, verbose)
  File "/opt/bench/erpnext/apps/frappe/frappe/installer.py", line 62, in create_database_and_user
    if force or (db_name not in dbman.get_database_list()):
  File "/opt/bench/erpnext/apps/frappe/frappe/model/db_schema.py", line 554, in get_database_list
    return [d[0] for d in self.db.sql("SHOW DATABASES")]
  File "/opt/bench/erpnext/apps/frappe/frappe/database.py", line 166, in sql
    self.connect()
  File "/opt/bench/erpnext/apps/frappe/frappe/database.py", line 116, in connect
    charset='utf8mb4', use_unicode = True, conv = conversions, local_infile = self.local_infile)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 327, in __init__
    self.connect()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 598, in connect
    self._request_authentication()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 852, in _request_authentication
    auth_packet = self._read_packet()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1698, u"Access denied for user 'root'@'localhost'")

and I solved mysql login issue according to above guide.
I am able to login to mysql/mariadb using command sudo mysql -u root -p

please help someone.

Ohh ! solved

I did run the command UPDATE user SET plugin='mysql_native_password' WHERE User='root';
but I don’t know what this command does?

According to documentation

mysql_native_password, which implements authentication against the mysql.user table using the native password hashing method.