|
Почему теряется соединение с БД MySQL из Python
|
|||
---|---|---|---|
#18+
Приветствую. Пытаюсь разобраться, как работать из Python с БД MySQL. Код такой try: with connect( host="xxx", user="yyy", password="zzz", database="ddd", ) as connection: print(connection) show_db_query = "SHOW DATABASES" with connection.cursor() as cursor: cursor.execute(show_db_query) for db in cursor: print(db) create_movies_table_query = """ CREATE TABLE movies( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100), release_year YEAR(4), genre VARCHAR(100), collection_in_mil INT ) """ with connection.cursor() as cursor: cursor.execute(create_movies_table_query) connection.commit() Но соединение куда-то пропадает постоянно на cursor.execute(create_movies_table_query), получаю "MySQL Connection not available." MySQL 5.7, Python 3.10 ... |
|||
:
Нравится:
Не нравится:
|
|||
16.12.2021, 07:25 |
|
|
start [/forum/topic.php?fid=47&msg=40120471&tid=1827842]: |
0ms |
get settings: |
10ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
160ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
31ms |
get tp. blocked users: |
2ms |
others: | 240ms |
total: | 476ms |
0 / 0 |