Error install ERPNext when create new-site

I’m deploying erpnext following this tutorial: GitHub - tkosin/ERPNext-GCP-Installation at f6f47b4e88601e6ebb923b8df19887447c1a5d21

To create a new site with the command “bench new-site --db-name erpnext erp.site.io

and I had an error with mysql, even if I entered the correct password for root

pleas help me ! I am newbie
thanks all !

File “/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, 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 1137, 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 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 33, in new_site
db_type = db_type)
File “/opt/bench/erpnext/apps/frappe/frappe/commands/site.py”, line 66, in _new_site
source_sql=source_sql,force=force, reinstall=reinstall, db_type=db_type)
File “/opt/bench/erpnext/apps/frappe/frappe/installer.py”, line 35, in install_db
setup_database(force, source_sql, verbose)
File “/opt/bench/erpnext/apps/frappe/frappe/database/init.py”, line 16, in setup_database
return frappe.database.mariadb.setup_db.setup_database(force, source_sql, verbose)
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/setup_db.py”, line 13, in setup_database
if force or (db_name not in dbman.get_database_list()):
File “/opt/bench/erpnext/apps/frappe/frappe/database/db_manager.py”, line 58, in get_database_list
return [d[0] for d in self.db.sql(“SHOW DATABASES”)]
File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 121, in sql
self.connect()
File “/opt/bench/erpnext/apps/frappe/frappe/database/database.py”, line 74, in connect
self._conn = self.get_connection()
File “/opt/bench/erpnext/apps/frappe/frappe/database/mariadb/database.py”, line 87, in get_connection
local_infile = frappe.conf.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 325, in init
self.connect()
File “/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 599, in connect
self._request_authentication()
File “/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 861, in _request_authentication
auth_packet = self._read_packet()
File “/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 684, 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’")
bench@instance-1:~/erpnext$

You have not set up the DB user/password permissions within the mysql/mariadb.
You probably used

mysql_secure_installation

initially - you’ll need the password that you inputted there… the commands below use ‘YourMYSQLpassword’ - which should be replaced with your actual password

mysqladmin -uroot password 'YourMYSQLpassword'
mysql -uroot -pYourMYSQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.%.%.%' IDENTIFIED BY 'YourMYSQLpassword' WITH GRANT OPTION;"
mysql -uroot -pYourMYSQLpassword -Bse "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'YourMYSQLpassword' WITH GRANT OPTION;"

and then rerun from your bench site commands onward.

Oh. thanks you
but when I configure mysql I have set the password for root
and I can log into mysql : " sudo mysql -u root -p"
and results

#trentmu

Do you have any ideas for the problem I have?

If you can get into the mysql terminal, the run these in the terminal…

GRANT ALL PRIVILEGES ON . TO ‘root’@‘127.%.%.%’ IDENTIFIED BY ‘YourMYSQLpassword’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ IDENTIFIED BY ‘YourMYSQLpassword’ WITH GRANT OPTION;

Once you have set the DB permissions this way, you can continue with your installation from the point where you got to, which looks like

bench new-site. --db-name erpnext erp.site.io

If you get an error about the erp.site.io already exists (it should be under ~/erpnext/sites), delete that subdirectory so it can be recreated

Thanks for your feedback
I will try

hey trentmu!
Did your idea change the password I set for root to log into mysql?

I used ‘YourMYSQLpassword’ as an example. If you used YOUR password in place of that, then it wouldn’t have changed the password.
You can also use this to update/edit it if necessary

mysqladmin -uroot password ‘YourNewMYSQLpassword’

I have understood “yourMYSQLpassword”
but the problem is:

  • current: root has been set a password to access mysql
    +if done:
    “GRANT ALL PRIVILEGES ON . TO ‘root’@‘127.%.%.%’ IDENTIFIED BY ‘YourMYSQLpassword’ WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ IDENTIFIED BY ‘YourMYSQLpassword’ WITH GRANT OPTION;”

-==> does it change the current pass

it authorises user ROOT with maximum access to the DB, from the internal server address, using the password in quotes. It does NOT actually change the password

ok. thanks you