Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLAlchemy no password supplied error

This is probably a silly error but I cannot seem to find a satisfying solution.

When running db.create_all(), I got the following error.

sqlalchemy.exc.OperationalError: (OperationalError) fe_sendauth: no password supplied  None None 

My database link is set as

'postgresql://localhost/db_name' 

This worked fine on my Mac and Heroku, but is not OK on ubuntu (digitalocean).

Any ideas what I might be doing wrong?

like image 626
yifanwu Avatar asked May 23 '14 23:05

yifanwu


2 Answers

You probably just need to remove "localhost" from your connection string:

'postgresql:///db_name' 

That tells psycopg2 to use Unix-domain sockets. Your default configuration will use "ident" so you'll be connecting as the user that runs the script. In the default configuration, "md5" only applies to TCP connections.

like image 130
Danny W. Adair Avatar answered Sep 19 '22 13:09

Danny W. Adair


URL pattern should be:

postgresql://user:password@localhost:5432/database_name 

pip install psycopg2
the user should be postgres or any other user you have created and intend to use

similarly for mySql it would be:

mysql://user:pass@localhost:3306/database_name 

pip install mysql-python

like image 25
omokehinde igbekoyi Avatar answered Sep 21 '22 13:09

omokehinde igbekoyi