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

Cant connect to MySQL DB #2

Closed
AndreyMariyko opened this issue Jan 27, 2022 · 2 comments
Closed

Cant connect to MySQL DB #2

AndreyMariyko opened this issue Jan 27, 2022 · 2 comments

Comments

@AndreyMariyko
Copy link

Again its me :)

try to connect on Mysql DB
next code:

from wireguard_db.models import DBConfig, DBConnect, WGData, WGRelation
  
setup = DBConfig().read(config_adapter='mysql')
db_mysql = DBConnect(setup).get()

and my output next:

_> root@node1:/project/wg/wireguardDB# python3 crdb.py

Traceback (most recent call last):
File "crdb.py", line 4, in
db_mysql = DBConnect(setup).get()
File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 33, in init
self.set(setup)
File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 81, in set
self.check()
File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 124, in check
dbtable.create_table(safe=True)
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 6717, in create_table
and cls.table_exists():
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 6707, in table_exists
return cls._schema.database.table_exists(M.table.name, M.schema)
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3326, in table_exists
return table_name in self.get_tables(schema=schema)
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 4042, in get_tables
return [table for table, in self.execute_sql(query, ('VIEW',))]
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3158, in execute_sql
cursor = self.cursor(commit)
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3142, in cursor
self.connect()
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3096, in connect
self._state.set_connection(self._connect())
File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 4013, in _connect
conn = mysql.connect(db=self.database, **self.connect_params)
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 353, in init
self.connect()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 633, in connect
self._request_authentication()
File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 869, in _request_authentication
authresp = _auth.scramble_caching_sha2(self.password, self.salt)
File "/usr/local/lib/python3.8/dist-packages/pymysql/_auth.py", line 198, in scramble_caching_sha2
p1 = hashlib.sha256(password).digest()
TypeError: object supporting the buffer API required
_

i think my problem in this(i.e. i have DB but show tables; Empty)

File "/project/wg/wireguardDB/wireguard_db/models/database.py", line 33, in init
self.set(setup)

  def __init__(self, setup: tuple = None):
        """
        Initialize a database connector on given setup
        :param config: dict: Optional, the setup from DBConfig.get(), can be setup later
        ivar _adapter: str: adapter name
        ivar _database: obj: peewee.DatabaseProxy
        ivar _connected: bool: connected state of db
        """
        self._adapter = None
        self._database = None
        self._connected = False

        if setup:
            # full init if setup is given
            **self.set(setup)**

FYI little problem YAML file generate with error username instead wguser wgdb

@marneu
Copy link
Owner

marneu commented Jan 27, 2022

Sorry, but it's not the time to use this module at the moment. Due to time lack I'm late to push a new version, where the DB is totally different from this one.

@marneu marneu closed this as completed Jan 27, 2022
@AndreyMariyko
Copy link
Author

no prob. thanks. I run script (numerical password my problem)

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