首页 > 解决方案 > Trouble connecting to SQL database in Jupyter Notebook

问题描述

I'm having trouble connecting to a SQL database in Juptyer Notebook.

I have changed the port to match the port on my computer (because it was not the default).

dbconn = psycopg2.connect(dbname='mimic',user=[hidden], host='localhost', password=[hidden], port=5433)

I'm using the exact username and password I use to login into the database online, so I expect it to successfully set up the connection, however Jupyter Notebook keeps giving me an Operational Error:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\psycopg2\__init__.py in connect(dsn, connection_factory, cursor_factory, **kwargs)
    124 
    125     dsn = _ext.make_dsn(dsn, **kwargs)
--> 126     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    127     if cursor_factory is not None:
    128         conn.cursor_factory = cursor_factory

OperationalError: FATAL:  password authentication failed for user 

标签: postgresqljupyter-notebookdatabase-connectionpgadmin-4

解决方案


推荐阅读