Issue with bench new-site - MySQL Access Denied (1698) Frappe-bench 15 on ubuntu 22.04.5

Command used:
cd frappe-bench
bench new-site newsitename.com

The root password is the one i’ve set up for mysql when I used this command if i’m not mistaken:

sudo mysql_secure_installation

But when prompted, I didnt change the root password i.e:

  • Enter current password for root: (Enter your SSH root user password)
  • Switch to unix_socket authentication [Y/n]: Y
  • Change the root password? [Y/n]: N
    It will ask you to set new MySQL root password at this step. This can be different from the SSH root user password.
  • Remove anonymous users? [Y/n] Y
  • Disallow root login remotely? [Y/n]: N
    This is set as N because we might want to access the database from a remote server for using business analytics software like Metabase / PowerBI / Tableau, etc.
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

PROBLEM
So when I did:
bench new-site newsitename.com

MySQL root password: <==I did both "enter" which means none and also i've input the password of the root account. It still results in the same error:

pymysql.err.OperationalError: (1698, "Access denied for user 'root'@'localhost'")

Can someone help trouble-shoot this?
Thank you in advance.

Try: sudo bench new-site newsitename.com

1 Like

This issue usually happens on Ubuntu 22.04 because MySQL root is configured with unix_socket authentication, which means it won’t accept a password the way bench new-site expects. That’s why you’re seeing the error (1698, "Access denied for user 'root'@'localhost'"). The clean fix is to avoid using the root account and instead create a dedicated MySQL. You can log in with sudo mysql -u root, then create a new user with a password, grant it privileges, and use that account in your bench new-site command. This way bench connects with a proper SQL user instead of the system root. If you really want to use root with a password, you can change the authentication plugin to mysql_native_password, but that’s less secure. Also, if you suspect the issue is tied to database corruption from earlier configuration changes, you can try a repair tool like Stellar Repair for MySQL, which can rebuild damaged databases and restore clean connectivity before running your site creation again.

1 Like