Set database password for command: bench reinstall

Hello all,

Is it possible to tell the bench reinstall command what to use for the database username and password?

I should note that the db_user and db_password are set correctly in the following files:

  • /home/frappe/frappe-bench/sites/common_site_config.json
  • /home/frappe/frappe-bench/sites/localhost/site_config.json

I am getting the following error when I use a database without the frappe/frappe username/password.

~/frappe-bench $ bench reinstall
This will wipe your database. Are you sure you want to reinstall? [y/N]: y
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 "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 138, in reinstall
    install_apps=installed, admin_password=admin_password)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 56, in _new_site
    admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 28, in install_db
    dbman.create_database(db_name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 510, in create_database
    if target in self.get_database_list():
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 538, in get_database_list
    return [d[0] for d in self.db.sql("SHOW DATABASES")]
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 106, in sql
    self.connect()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 52, in connect
    use_unicode=True, charset='utf8')
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'frappe'@'172.17.0.6' (using password: YES)")```

You need to set the root_password property

Thanks @rmehta. Is it possible to set the root_user?