This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.13" | |
# dependencies = [ | |
# "mysql-connector-python", | |
# ] | |
# /// | |
import mysql.connector | |
# Database configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
from datetime import datetime | |
# Get Unix epoch time (1970-01-01 00:00:00) | |
epoch_time = datetime.utcfromtimestamp(0) # Unix time 0 in UTC | |
# MySQL-compatible timestamp string | |
formatted_time = epoch_time.strftime('%Y-%m-%d %H:%M:%S') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
import re | |
slow_log_files = ['file1','file2'] | |
table = "slow_log" | |
connection = mysql.connector.connect( | |
host="127.0.0.1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
import subprocess | |
import os | |
db = 'test' | |
table = 'lineitem' | |
version = 'v8.3.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
try: | |
connection = mysql.connector.connect( | |
host="127.0.0.1", | |
port="4000", | |
user="root", | |
password="", | |
database="test" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
import mysql.connector | |
from mysql.connector import pooling | |
from collections import Counter | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"fmt" | |
"log" | |
_ "github.com/go-sql-driver/mysql" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
from mysql.connector import pooling | |
import sys | |
# Create a connection pool | |
dbconfig = { | |
"database": "test", | |
"user": "root", |
NewerOlder