Forums

MySQL Permissions

I'm using a Flask app with MySQL connections. I have a lot of select statements in my code, and most of them work - the ones that do are querying tables I set up manually. However, I just imported some tables from sql files and now I get the following error ONLY on those tables:

MySQLdb._exceptions.OperationalError: (1142, "SELECT command denied to user 'abrenon'@'10.0.0.234' for table 'tbl_webpage_images'")

I've tried giving myself permissions on those tables, but get:

ERROR 1142 (42000): GRANT command denied to user 'abrenon'@'10.0.0.97' for table 'tbl_azure_img_tags_box'

Any help is greatly appreciated, thanks!

the correct table is probably something like abrenon$tbl_webpage_images

Do tables also have the prefix? I know databases do. For reference, here's what I get when i run SHOW tables in MySQL:

+-----------------------------+
| Tables_in_abrenon$workspace |
+-----------------------------+
| FinalData                   |
| PPM                         |
| PPP                         |
| tbl_addresses               |
| tbl_addresses_box           |
| tbl_addresses_box_x         |
| tbl_addresses_x             |
| tbl_azure_img_desc          |
| tbl_azure_img_desc_x        |
| tbl_azure_img_tags          |
| tbl_azure_img_tags_box      |
| tbl_azure_img_tags_box_x    |
| tbl_azure_img_tags_x        |
| tbl_box_images              |
| tbl_image_hash              |
| tbl_webpage_images          |
| tbl_webpages                |
+-----------------------------+

so in your example, the database would be abrenon$workspace, but the table would be tbl_addresses

Ok, that's what I thought. However, when I try to write a query (in the MySQL shell, not even just in my code), it still gives me the 1142 error. I tried making a new user to grant the privileges to but got

ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation

Do I not have the ability to make new users? This was just trying to make it, not even trying to give it privileges.

You are correct, for MySQL you don't have admin rights and don't have privileges to create new users. If you need more privileges you would have to upgrade and pay for a Postgres database. On the PythonAnywhere MySQL database page you can see your user, set your password for your user, and create databases from there.