Forums

Assistance Needed: Issue with server error

Here's my PythonAnywhere username: Amberlanqinyun.

I'm experiencing some issues with the server error on the following pages, which work fine from the local repository but are not able to load the data on PythonAnywhere:

http://amberlanqinyun.pythonanywhere.com/listmembers http://amberlanqinyun.pythonanywhere.com/admin/memberlist/ http://amberlanqinyun.pythonanywhere.com/admin/teammembers_report/

I have attached the error log for your reference. It would be great if you could look into this.

Thanks again for your assistance!


2023-06-08 03:43:02,311: Exception on /listmembers [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 535, in cmd_query
    self._cmysql.query(query,
_mysql_connector.MySQLInterfaceError: SELECT command denied to user 'Amberlanqinyun'@'10.0.0.238' for table 'members'
**NO MATCH**
During handling of the above exception, another exception occurred:
**NO MATCH**
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/Amberlanqinyun/Web-Application-Project/nzolywebapp/nzolywebapp/app.py", line 37, in listmembers
    connection.execute("""
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/cursor_cext.py", line 269, in execute
    result = self._cnx.cmd_query(stmt, raw=self._raw,
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 540, in cmd_query
    raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.ProgrammingError: 1142 (42000): SELECT command denied to user 'Amberlanqinyun'@'10.0.0.238' for table 'members'
2023-06-08 03:43:07,925: Exception on /listmembers [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 535, in cmd_query
    self._cmysql.query(query,
_mysql_connector.MySQLInterfaceError: SELECT command denied to user 'Amberlanqinyun'@'10.0.0.238' for table 'members'
**NO MATCH**
During handling of the above exception, another exception occurred:
**NO MATCH**
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/Amberlanqinyun/Web-Application-Project/nzolywebapp/nzolywebapp/app.py", line 37, in listmembers
    connection.execute("""
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/cursor_cext.py", line 269, in execute
    result = self._cnx.cmd_query(stmt, raw=self._raw,
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 540, in cmd_query
    raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.ProgrammingError: 1142 (42000): SELECT command denied to user 'Amberlanqinyun'@'10.0.0.238' for table 'members'

[edit by admin - formatting]

It looks like your user doesn't have permissions on the database youre trying to query. Try logging into the database using a by going to the 'Database' tab and clicking the database name. Then you'll need to grant priviledges to your user

https://stackoverflow.com/questions/5016505/mysql-grant-all-privileges-on-database