Forums

ERROR 1044 (42000): Access denied for user 'closercreationz'@'%' to database 'closercreationz$myapp'

I am trying to access my database in the Website..... i found lot of problem in this ..... I had tried to change the privileges for the user... but that failed... is there any way to solve this..... Please anybody help me...

mysql=MySQLdb.connect(host="closercreationz.mysql.pythonanywhere-services.com", user="closercreationz", passwd="REDACTED", db="closercreation$myapp")

   mysql> show grants;
   +------------------------------------------------------------------------------+
   | Grants for closercreationz@%                                                 |
   +------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO 'closercreationz'@'%'                                  |
    | GRANT ALL PRIVILEGES ON `closercreationz$myapp`.* TO 'closercreationz'@'%'   |
    | GRANT ALL PRIVILEGES ON `closercreationz$base`.* TO 'closercreationz'@'%'    |
    | GRANT ALL PRIVILEGES ON `closercreationz$default`.* TO 'closercreationz'@'%' |
    +------------------------------------------------------------------------------+
    4 rows in set (0.01 sec)

[edit by admin: redacted password, reformatted]

Are you sure you're using the correct password? (I've redacted it in your post because it's not something you should share publicly.)

You can see the exact password that you set inside the file .my.cnf in your file storage.

My password matched with the existing one... I think this have any other problem.

The problem is that you've misspelled the database name.

thanks sir.. i have changed that but now i got a new problem...

please view that image sir

You cannot run flask from a console. Use a web app for that.

ok sir i tried to run the web app

how to import that module sir

https://closercreationz.pythonanywhere.com/education

What module? Is it on your Python path? Is it installed into the same version of Python/virtualenv as your web app is using?

MySQLdb import error sir.... Wtforms are also not available to import... I installed the package required but I found the error after started working with MySQLdb...

Please help me with some basic code to connect with database...

Can I take a look at your files? We can see them from our admin interface, but we always ask for permission first.

Ok sir please check my files.....

I don't see the packages in your virtualenv. In order to install packages into it, you need to click the "Start a bash console in this virtualenv" link on the "Web" page, and then use "pip install" to install the packages.

After installing the flask-mysqldb.. i found the error as ModuleNotFoundError: No module named 'flask_mysqldb' error running WSGI application. should i need to add any configuration in WSGI file??

I think you probably need to reload your website using the button on the "Web" tab -- it might not pick up newly-installed modules until you do that.

That problem solved sir.... I got new one sir. Passlib I installed the Passlib..... But it shows that module not found

The exact error right now is this:

ImportError: cannot import name 'sha256_crypt'

The code that is generating it is

from passlib.hash import sha256_crypt

So it can load passlib, but not the hash.sha256_crypt submodule. That is pretty strange -- the submodule is definitely built in. Have you tried reloading your website, though?

Yes I tried to reload it but it throws error.

Is there any other way to install that submodule??

Make sure that you're using a version of passlib that includes the particular hash.