50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
import pymysql
|
|
from sshtunnel import SSHTunnelForwarder
|
|
from pymysql.converters import escape_string
|
|
from ruamel.yaml import YAML
|
|
import math
|
|
|
|
# ===================config===================
|
|
|
|
|
|
server = SSHTunnelForwarder(
|
|
ssh_address_or_host=("1.15.182.107", 22),
|
|
ssh_username="root",
|
|
ssh_password="`NS?VGg@7]~F3}p",
|
|
remote_bind_address=("127.0.0.1",3306),
|
|
local_bind_address=('127.0.0.1',5143)
|
|
)
|
|
server.start()
|
|
db_host = server.local_bind_host
|
|
db_port = server.local_bind_port
|
|
RID = 200100030
|
|
MYRID = 100100017
|
|
ServerId = int((RID % 100000000) / 100000)
|
|
conn = pymysql.connect(
|
|
host=db_host,
|
|
port=db_port,
|
|
user="root",
|
|
password="Z4rf7eZZe500dxa",
|
|
database=f"Merge_Pet_sdk"
|
|
)
|
|
cursor = conn.cursor()
|
|
cursor.execute(("select * from t_player_mod where dwUin = {rid}").format(rid = RID))
|
|
result1 = cursor.fetchone()
|
|
|
|
conn1 = pymysql.connect(
|
|
host="127.0.0.1",
|
|
port=3306,
|
|
user="root",
|
|
password="root",
|
|
database='Merge_Pet_1'
|
|
)
|
|
cursor1 = conn1.cursor()
|
|
sql = "UPDATE t_player_mod SET mData = %s WHERE dwUin = %s"
|
|
cursor1.execute(sql, (result1[1], MYRID))
|
|
conn1.commit()
|
|
|
|
cursor.close()
|
|
conn.close()
|
|
cursor1.close()
|
|
conn1.close()
|
|
exit() |