问题
I am using PythonAnywhere to host my web application for testing purpose. My frontend and python script is working fine. Now I want to connect it to MySQL database. I have uploaded my .sql file to the mysite folder and trying to restore it using this syntax:
mysql -u username -h username.mysql.pythonanywhere-services.com 'username$scm' < ab.sql
as told in Backing up (and restoring) MySQL databases (where username=created username) but it's throwing this error:
ERROR 1419 (HY000) at line 88: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_
trust_function_creators variable)
I've tried to fix this error by following this How to grant super privilege to the user? but still it's throwing error:
ERROR 1044 (42000): Access denied for user 'username'@'%' to database 'username$scm'
Please help me out.
回答1:
Take a look at the answer on PythonAnywhere forums:
You would not be able to get super privileges on MySQL (only postgres). Could you disable binary logging before doing the restore? You could either try to edit the ab.sql file to take out that line, or turn it off from wherever you were creating the sqldump originally, and doing the sqldump again.
来源:https://stackoverflow.com/questions/59150115/how-to-add-super-priviledge-to-mysql-in-pythonanywhere