Error while adding a new-site

Hello Community,

While adding new-site in bench, I am facing with this error:

$ bench new-site site1.local

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 “/home/devops/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/devops/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/devops/frappe-bench/apps/frappe/frappe/commands/site.py”, line 34, in new_site
verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
File “/home/devops/frappe-bench/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 “/home/devops/frappe-bench/apps/frappe/frappe/installer.py”, line 36, in install_db
create_database_and_user(force, verbose)
File “/home/devops/frappe-bench/apps/frappe/frappe/installer.py”, line 60, in create_database_and_user
if force or (db_name not in dbman.get_database_list()):
File “/home/devops/frappe-bench/apps/frappe/frappe/model/db_schema.py”, line 549, in get_database_list
return [d[0] for d in self.db.sql(“SHOW DATABASES”)]
File “/home/devops/frappe-bench/apps/frappe/frappe/database.py”, line 136, in sql
self.connect()
File “/home/devops/frappe-bench/apps/frappe/frappe/database.py”, line 86, in connect
charset=‘utf8mb4’, use_unicode = True, conv = conversions)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/init.py”, line 90, in Connect
return Connection(*args, **kwargs)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 706, in init
self.connect()
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 932, in connect
self._request_authentication()
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1152, in _request_authentication
auth_packet = self._read_packet()
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1014, in _read_packet
packet.check_error()
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 393, in check_error
err.raise_mysql_exception(self._data)
File “/home/devops/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1698, u"Access denied for user ‘root’@‘localhost’")

I believe I am entering right password for mysql. I am able to login to mysql console successfully.
Kindly, help with this error.

Try this:

mysql -u root -p

MariaDB [(none)]> GRANT all privileges on *.* to 'root'@'localhost' IDENTIFIED BY 'your root password' WITH GRANT OPTION;

You may have to restart mysql service after doing this.

3 Likes

Thanks @netchampfaris , for the quick reply. I’ve tried as you suggested but it’s still throwing same error.

SHOW GRANTS FOR 'root'@'localhost';

Share the output of this command

Here is the output.

mysql> SHOW GRANTS FOR ‘root’@‘localhost’;
±--------------------------------------------------------------------+
| Grants for root@localhost |
±--------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ WITH GRANT OPTION |
| GRANT PROXY ON ‘’@‘’ TO ‘root’@‘localhost’ WITH GRANT OPTION |
±--------------------------------------------------------------------+
2 rows in set (0.00 sec)

Run this

update mysql.user set password=PASSWORD('your password') where ifnull(password, '')='';

and restart mysql server

1 Like

Many thanks