Python Forum
[mysql.connector] The database is never connected to and there are no errors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[mysql.connector] The database is never connected to and there are no errors
#8
I made the for loop so that it also detects changes in the columns, though I haven't tested it yet. For the original problem, I opened up cmder, ran a Python shell, and I get an error when I try to create a database
db_tables = {table[0]: table[1:] for table in cursor}
for table, fields in tables.items():
    if table not in db_tables or len(tuple(set(fields).difference(set(db_tables[table]))) + tuple(set(db_tables[table]).difference(set(fields)))) > 0:
        self.delete_table(table)
        self.cursor.execute("CREATE TABLE %s (%s)" % (table, ", ".join(fields)))
Error:
Traceback (most recent call last): File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\network.py", line 509, in open_connection self.sock.connect(sockaddr) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\__init__.py", line 179, in connect return MySQLConnection(*args, **kwargs) File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\connection.py", line 95, in __init__ self.connect(**kwargs) File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\abstracts.py", line 716, in connect self._open_connection()
I don't know what to do to fix this error.
Reply


Messages In This Thread
RE: [mysql.connector] The database is never connected to and there are no errors - by SheeppOSU - Jun-04-2020, 09:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Display name of a pc connected over lan fatopeo 1 1,448 Mar-16-2022, 10:10 AM
Last Post: Gribouillis
  mysql connector/telnet issue (re: text game) rebubula76 1 2,579 Feb-06-2018, 08:00 PM
Last Post: rebubula76

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020