Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied for user 'root'@'localhost' #379

Open
Th3L1nuxGuy opened this issue Jun 1, 2022 · 1 comment
Open

Access denied for user 'root'@'localhost' #379

Th3L1nuxGuy opened this issue Jun 1, 2022 · 1 comment

Comments

@Th3L1nuxGuy
Copy link

I'm not sure if this is a bug or something I'm doing wrong, but I have a fully up-to-date Ubuntu 20.04 VM that I'm trying to get Oncall to run on, and I'm having issues.

As it appears many of the python2 packages are either unavailable or simply deprecated in Ubuntu 20.04, I handled with prerequisites with the following command:

sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev python3-pip python3-setuptools mysql-server mysql-client

Then after unpacking version 1.4.5 into /opt, I did cd /opt/oncall-1.4.5 and then ran the following:

python3 setup.py develop
pip3 install -e '.[dev]'

The setup finally finished but did complain:

ERROR: sphinx-rtd-theme 1.0.0 has requirement docutils<0.18, but you'll have docutils 0.18.1 which is incompatible.
ERROR: sphinx-rtd-theme 1.0.0 has requirement sphinx>=1.6, but you'll have sphinx 1.5.6 which is incompatible.
ERROR: sphinxcontrib-httpdomain 1.8.0 has requirement Sphinx>=1.6, but you'll have sphinx 1.5.6 which is incompatible.

Set up my MySQL schema:

mysql -u root -p < ./db/schema.v0.sql

I then start the software (oncall-dev ./configs/config.yaml or make serve) and the page loads correctly on port 8080. However when I attempt to login, I get an error that the username and/or password is invalid. Server side I see this:

[2022-06-01 15:38:26 -0600] [437216] [INFO] Starting gunicorn 20.1.0
[2022-06-01 15:38:26 -0600] [437216] [INFO] Listening at: http://0.0.0.0:8080 (437216)
[2022-06-01 15:38:26 -0600] [437216] [INFO] Using worker: gevent
[2022-06-01 15:38:26 -0600] [437218] [INFO] Booting worker with pid: 437218
[2022-06-01 15:38:26 -0600] [437219] [INFO] Booting worker with pid: 437219
[2022-06-01 15:38:26 -0600] [437220] [INFO] Booting worker with pid: 437220
[2022-06-01 15:38:26 -0600] [437221] [INFO] Booting worker with pid: 437221
INFO:oncall.auth:Auth debug turned on.
INFO:oncall.auth:Auth debug turned on.
INFO:oncall.auth:Auth debug turned on.
INFO:oncall.auth:Auth debug turned on.
Building bundle: bundles/libs.js
INFO:webassets:Building bundle: bundles/libs.js
2022-06-01 15:38:26,860 INFO webassets Building bundle: bundles/libs.js
Building bundle: bundles/oncall.bundle.js
INFO:webassets:Building bundle: bundles/oncall.bundle.js
2022-06-01 15:38:26,866 INFO webassets Building bundle: bundles/oncall.bundle.js
Building bundle: bundles/libs.css
INFO:webassets:Building bundle: bundles/libs.css
2022-06-01 15:38:26,868 INFO webassets Building bundle: bundles/libs.css
Building bundle: bundles/oncall.css
INFO:webassets:Building bundle: bundles/oncall.css
2022-06-01 15:38:26,871 INFO webassets Building bundle: bundles/oncall.css
Building bundle: bundles/loginsplash.css
INFO:webassets:Building bundle: bundles/loginsplash.css
2022-06-01 15:38:26,872 INFO webassets Building bundle: bundles/loginsplash.css
Building bundle: bundles/loginsplash.bundle.js
INFO:webassets:Building bundle: bundles/loginsplash.bundle.js
2022-06-01 15:38:26,872 INFO webassets Building bundle: bundles/loginsplash.bundle.js
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET / HTTP/1.1" 200 109744 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /static/bundles/oncall.css?6fc23d98 HTTP/1.1" 200 0 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /static/bundles/libs.css?d0c82c20 HTTP/1.1" 200 0 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /static/images/oncall_logo_white.png HTTP/1.1" 200 0 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /static/bundles/oncall.bundle.js?261df4d9 HTTP/1.1" 200 0 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /static/bundles/libs.js?fc4ec214 HTTP/1.1" 200 0 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /api/v0/iris_settings HTTP/1.1" 200 354 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
10.215.90.86 - - [01/Jun/2022:15:38:29 -0600] "GET /api/v0/timezones/ HTTP/1.1" 200 123 "http://example.com:8080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"
[2022-06-01 15:38:29 -0600] [437219] [ERROR] Error handling request /api/v0/roles/
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/base.py", line 3280, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 310, in connect
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 868, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 476, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 146, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 143, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 256, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 371, in __init__
    self.__connect()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 666, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 661, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/create.py", line 590, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/default.py", line 597, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 353, in __init__
    self.connect()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 633, in connect
    self._request_authentication()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 907, in _request_authentication
    auth_packet = self._read_packet()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1698, "Access denied for user 'root'@'localhost'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base_async.py", line 55, in handle
    self.handle_request(listener_name, req, client, addr)
  File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/ggevent.py", line 127, in handle_request
    super().handle_request(listener_name, req, sock, addr)
  File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base_async.py", line 108, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/opt/oncall/src/oncall/app.py", line 118, in __call__
    return self.app(env, start_response)
  File "/usr/local/lib/python3.8/dist-packages/Beaker-1.11.0-py3.8.egg/beaker/middleware.py", line 156, in __call__
    return self.wrap_app(environ, session_start_response)
  File "/usr/local/lib/python3.8/dist-packages/falcon-1.4.1-py3.8.egg/falcon/api.py", line 244, in __call__
    responder(req, resp, **params)
  File "/opt/oncall/src/oncall/api/v0/roles.py", line 97, in on_get
    connection = db.connect()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/base.py", line 3313, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/base.py", line 3283, in _wrap_pool_connect
    Connection._handle_dbapi_exception_noconnection(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2117, in _handle_dbapi_exception_noconnection
    util.raise_(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/base.py", line 3280, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 310, in connect
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 868, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 476, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 146, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 143, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 256, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 371, in __init__
    self.__connect()
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 666, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/pool/base.py", line 661, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/create.py", line 590, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.8/dist-packages/SQLAlchemy-1.4.37-py3.8-linux-x86_64.egg/sqlalchemy/engine/default.py", line 597, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 353, in __init__
    self.connect()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 633, in connect
    self._request_authentication()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 907, in _request_authentication
    auth_packet = self._read_packet()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/usr/local/lib/python3.8/dist-packages/PyMySQL-1.0.2-py3.8.egg/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1698, "Access denied for user 'root'@'localhost'")
(Background on this error at: https://sqlalche.me/e/14/e3q8)

I can login to the database without issue from the command prompt (e.g. mysql -u root -p) with no password. I've assigned the root user the same password in the config.yaml, but with the same results.

@free6k
Copy link

free6k commented Aug 1, 2022

You has mysql version > 8. Use old version for store password. the python client doesn't support new password protocol

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants