Coder Social home page Coder Social logo

Running 'setup.py' hashview tries to connect to MySQL using mysql-password@localhost (Ubuntu 22.04 on WSL2 | Windows 11) about hashview HOT 7 CLOSED

InfiniteBSOD avatar InfiniteBSOD commented on June 9, 2024
Running 'setup.py' hashview tries to connect to MySQL using mysql-password@localhost (Ubuntu 22.04 on WSL2 | Windows 11)

from hashview.

Comments (7)

i128 avatar i128 commented on June 9, 2024

Am i correct in understanding that the password you used for the mysql user is showing up in your error?

_mysql_connector.MySQLInterfaceError: Unknown MySQL server host '@localhost' (-2)
sqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 2005 (HY000): Unknown MySQL server host '@localhost'

from hashview.

InfiniteBSOD avatar InfiniteBSOD commented on June 9, 2024

@i128

Thank you for your quick reply, yes that is correct.
The password is shown preceeding "@localhost" in the error messages above

from hashview.

i128 avatar i128 commented on June 9, 2024

After you run setup.py it should create a file at ./hashview/config.conf. Check that file to see if the username/password for the mysql hashview account is correct. If its wrong, you can modify the file manually.

from hashview.

InfiniteBSOD avatar InfiniteBSOD commented on June 9, 2024

@i128

Thank you, I checked the file and the user / pass for the MySQL-user for hashview are correct.

However when trying to start hashview with "./hashview.py":

ubuntu@wsl2:~/git/hashview$ ./hashview.py
Exception!:
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 288, in _open_connection
    self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Unknown MySQL server host '<my-mysql-password-for-the-mysql-user-hashview>@localhost' (-2)

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

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3275, in raw_connection
    return self.pool.connect()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 455, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 1271, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 719, in checkout
    rec = pool._do_get()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 283, in _do_get
    return self._create_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 396, in _create_connection
    return _ConnectionRecord(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 681, in __init__
    self.__connect()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 905, in __connect
    with util.safe_reraise():
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 901, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 640, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 580, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/pooling.py", line 293, in connect
    return CMySQLConnection(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 118, in __init__
    self.connect(**kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/abstracts.py", line 1178, in connect
    self._open_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 293, in _open_connection
    raise get_mysql_exception(
mysql.connector.errors.DatabaseError: 2005 (HY000): Unknown MySQL server host '<my-mysql-password-for-the-mysql-user-hashview>@localhost' (-2)

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

Traceback (most recent call last):
  File "/home/ubuntu/git/hashview/./hashview.py", line 343, in cli
    ensure_version_alignment()
  File "/home/ubuntu/git/hashview/./hashview.py", line 232, in ensure_version_alignment
    upgrade()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/flask_migrate/__init__.py", line 111, in wrapped
    f(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/flask_migrate/__init__.py", line 200, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/alembic/command.py", line 378, in upgrade
    script.run_env()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/alembic/script/base.py", line 576, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/ubuntu/.local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ubuntu/git/hashview/migrations/env.py", line 96, in <module>
    run_migrations_online()
  File "/home/ubuntu/git/hashview/migrations/env.py", line 81, in run_migrations_online
    with connectable.connect() as connection:
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3251, in connect
    return self._connection_cls(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2413, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3275, in raw_connection
    return self.pool.connect()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 455, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 1271, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 719, in checkout
    rec = pool._do_get()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 283, in _do_get
    return self._create_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 396, in _create_connection
    return _ConnectionRecord(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 681, in __init__
    self.__connect()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 905, in __connect
    with util.safe_reraise():
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 901, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 640, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 580, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/pooling.py", line 293, in connect
    return CMySQLConnection(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 118, in __init__
    self.connect(**kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/abstracts.py", line 1178, in connect
    self._open_connection()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 293, in _open_connection
    raise get_mysql_exception(
sqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 2005 (HY000): Unknown MySQL server host '<my-mysql-password-for-the-mysql-user-hashview>@localhost' (-2)
(Background on this error at: https://sqlalche.me/e/20/4xp6)

from hashview.

i128 avatar i128 commented on June 9, 2024

Can you post the config here (with the password omitted)
Does your password contain any special characters, ; or = for example?

from hashview.

InfiniteBSOD avatar InfiniteBSOD commented on June 9, 2024

Can you post the config here (with the password omitted) Does your password contain any special characters, ; or = for example?

Sorry for my late reply.

I recreated the "hashview" MySQL-user and set the password:
DoNotUseThisPassword123!
just to try this with another password, my earlier password was a 16-char autogenerated password which included special chars such as @!€.

However now I get:

Bulding Database
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 288, in _open_connection
    self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Access denied for user 'hashview'@'localhost' (using password: YES)

but if I try the exact same (I've copied - pasted the password) to login to MySQL;

ubuntu@wsl2:~/git/hashview$ sudo mysql -u hashview -p
Enter password: <here I enter:  DoNotUseThisPassword123!>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 8.0.32-0ubuntu0.22.04.2 (Ubuntu)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Any ideas?

from hashview.

i128 avatar i128 commented on June 9, 2024

Yeah chances are its an issue with the character set used when encoding the password.
Best bet would be to try and use a password that uses a-zA-Z0-9 and !@#$%^&*().

from hashview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.