Data-App
Data-App copied to clipboard
(1045, "Access denied for user 'root'@'localhost' (using password: YES)")
After clicking the register button with a username and password, I get this error screen:

Looking at the traceback (it's quite long, but I think relevant stuff is at the bottom?), it says this:
[2022-03-06 16:45:32,138] ERROR in app: Exception on /auth/register [POST]
Traceback (most recent call last):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3212, in _wrap_pool_connect
return fn()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 307, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 767, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 425, in checkout
rec = pool._do_get()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 146, in _do_get
self._dec_overflow()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
with_traceback=exc_tb,
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 143, in _do_get
return self._create_connection()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 253, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 368, in __init__
self.__connect()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 611, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
with_traceback=exc_tb,
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 605, in __connect
connection = pool._invoke_creator(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\create.py", line 578, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\default.py", line 584, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient_Finance_Web_App\Prescient\views\auth.py", line 25, in register
if form.validate_on_submit():
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\flask_wtf\form.py", line 100, in validate_on_submit
return self.is_submitted() and self.validate()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\form.py", line 318, in validate
return super(Form, self).validate(extra)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\form.py", line 150, in validate
if not field.validate(self, extra):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\fields\core.py", line 226, in validate
stop_validation = self._run_validation_chain(form, chain)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\fields\core.py", line 246, in _run_validation_chain
validator(form, self)
File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient_Finance_Web_App\Prescient\forms.py", line 21, in validate_username
user = User.query.filter_by(username=username.data).first()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\query.py", line 2762, in first
return self.limit(1)._iter().first()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\query.py", line 2849, in _iter
execution_options={"_sa_orm_load_options": self.load_options},
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 1688, in execute
conn = self._connection_for_bind(bind)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 1530, in _connection_for_bind
engine, execution_options
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 747, in _connection_for_bind
conn = bind.connect()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3166, in connect
return self._connection_cls(self, close_with_result=close_with_result)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 96, in __init__
else engine.raw_connection()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3245, in raw_connection
return self._wrap_pool_connect(self.pool.connect, _connection)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3216, in _wrap_pool_connect
e, dialect, self
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 2070, in _handle_dbapi_exception_noconnection
sqlalchemy_exception, with_traceback=exc_info[2], from_=e
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3212, in _wrap_pool_connect
return fn()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 307, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 767, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 425, in checkout
rec = pool._do_get()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 146, in _do_get
self._dec_overflow()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
with_traceback=exc_tb,
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 143, in _do_get
return self._create_connection()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 253, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 368, in __init__
self.__connect()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 611, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
with_traceback=exc_tb,
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 605, in __connect
connection = pool._invoke_creator(self)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\create.py", line 578, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\default.py", line 584, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
(Background on this error at: https://sqlalche.me/e/14/e3q8)
127.0.0.1 - - [06/Mar/2022 16:45:32] "POST /auth/register HTTP/1.1" 500 -
127.0.0.1 - - [06/Mar/2022 16:45:32] "GET /favicon.ico HTTP/1.1" 404 -
How to fix? Using Windows 10, Python 3.8. Thanks!
I narrowed it down to an SQL-Alchemy version issue, so I ran pip install -r requirements.txt to match your environment, but now I see this error:
[2022-03-06 17:00:22,385] ERROR in app: Exception on /auth/register [POST]
Traceback (most recent call last):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\_collections.py", line 1008, in __call__
return self.registry[key]
KeyError: <greenlet.greenlet object at 0x000001D9FD292D58 (otid=0x000001D9FD289BD8) current active started main>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient\Prescient\views\auth.py", line 25, in register
if form.validate_on_submit():
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_wtf\form.py", line 100, in validate_on_submit
return self.is_submitted() and self.validate()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\wtforms\form.py", line 310, in validate
return super(Form, self).validate(extra)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\wtforms\form.py", line 152, in validate
if not field.validate(self, extra):
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\wtforms\fields\core.py", line 206, in validate
stop_validation = self._run_validation_chain(form, chain)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\wtforms\fields\core.py", line 226, in _run_validation_chain
validator(form, self)
File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient\Prescient\forms.py", line 21, in validate_username
user = User.query.filter_by(username=username.data).first()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 519, in __get__
return type.query_class(mapper, session=self.sa.session())
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\scoping.py", line 47, in __call__
return self.registry()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\_collections.py", line 1010, in __call__
return self.registry.setdefault(key, self.createfunc())
File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 4101, in __call__
return self.class_(**local_kw)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 138, in __init__
bind = options.pop('bind', None) or db.engine
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 937, in engine
return self.get_engine()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 956, in get_engine
return connector.get_engine()
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 560, in get_engine
options = self.get_options(sa_url, echo)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 575, in get_options
self._sa.apply_driver_hacks(self._app, sa_url, options)
File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask_sqlalchemy\__init__.py", line 878, in apply_driver_hacks
sa_url.query.setdefault('charset', 'utf8')
AttributeError: 'sqlalchemy.cimmutabledict.immutabledict' object has no attribute 'setdefault'
127.0.0.1 - - [06/Mar/2022 17:00:22] "POST /auth/register HTTP/1.1" 500 -
127.0.0.1 - - [06/Mar/2022 17:00:22] "GET /favicon.ico HTTP/1.1" 404 -
Set Default looks to be wrong here?
Hi, did you found any way to solve the problem because I'm stuck on the same issue.
Nope