frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.89k stars 7.34k forks source link

AWS RDS new-site error #16052

Open berniezhao11 opened 5 years ago

berniezhao11 commented 5 years ago

AWS RDS does not allow GRANT SUPER privilege so the GRANT ALL does not work when creating new site.

When run sudo bench new-site erpnext the following error shows up.

Is there anyway to work around this issue? I'm thinking install the new site on local Database then copy the database to RDS, then change Strappe to point to new DB?

  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 72, in create_database_and_user
    dbman.grant_all_privileges(db_name, db_name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 538, in grant_all_privileges
    user, host))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 176, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
    result.read()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
    packet.check_error()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1044, u"Access denied for user 'root'@'%' to database '76cf18db07302d32'")
chdecultot commented 5 years ago

Hi @berniezhao11,

We are using RDS for our ERPNext instances and never faced this issue.

On which version are you ?

In any case, you should never use sudo to create a new site. If that's the case you have an overall problem with your frappe bench folder permissions in Linux that should be resolved first.

Salmanmulani commented 5 years ago

Will request you to post this query on https://discuss.erpnext.com. If this bug is validated, then we can reopen issue.

Olawale1 commented 5 years ago

Hi @chdecultot

Could you please give some insight into how you set this up? I actually posted this request on the forum:

https://discuss.erpnext.com/t/how-to-use-aws-rds-for-erpnext/43258

Thanks

chdecultot commented 5 years ago

Hi @Olawale1,

RDS is just a normal database running on a different server, so there are only a few things to do:

  1. Configure the database parameters according to Frappe's requirements (depends on the mariadb version and can be found in the easy install script or in several posts on the forum).
  2. Add the db_host parameter in site_config.json with the address of your rds instance.

That's all!