Browse Source

pymysql方法修正

Daniel 1 year ago
parent
commit
b31902ddb7

+ 1 - 1
.idea/misc.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="py311Quant" project-jdk-type="Python SDK" />
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
   <component name="PyPackaging">
     <option name="earlyReleasesAsUpgrades" value="true" />
   </component>

+ 1 - 1
.idea/stock.iml

@@ -2,7 +2,7 @@
 <module type="PYTHON_MODULE" version="4">
   <component name="NewModuleRootManager">
     <content url="file://$MODULE_DIR$" />
-    <orderEntry type="jdk" jdkName="py311Quant" jdkType="Python SDK" />
+    <orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module" module-name="stocks_to_sql" />
     <orderEntry type="module" module-name="quantify01" />

+ 31 - 21
QMT/230504_real_time.py

@@ -6,7 +6,7 @@ from xtquant.xttrader import XtQuantTrader, XtQuantTraderCallback
 from xtquant.xttype import StockAccount
 from xtquant import xtdata, xtconstant
 import time
-from sqlalchemy import create_engine
+from sqlalchemy import create_engine, text
 from jqdatasdk import *
 import pymysql
 import multiprocessing as mp
@@ -23,7 +23,8 @@ acc = StockAccount('920000207040', 'SECURITY')
 # 生成session id 整数类型 同时运行的策略不能重复
 session_id = 123456
 xt_trader = None
-engine_stock = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8')
+engine_stock = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8',
+                             pool_size=5000, pool_recycle=50, max_overflow=-1)
 auth('18616891214', 'Ea?*7f68nD.dafcW34d!')
 
 
@@ -120,7 +121,7 @@ def run(seq, pid):
             sys.exit()
             break
             # return 0
-    # return
+    return
 
 
 def get_fundamentals(results):
@@ -132,9 +133,10 @@ def ma(stock, num, data):
     global engine_stock
     try:
         i = (num - 1) * -1
-        df = pd.read_sql_query(
-            'select close_front from `%s_1d`' % stock, engine_stock)
-    except:
+        df = pd.read_sql_query(text(
+            'select close_front from `%s_1d`'% stock), engine_stock.connect())
+    except BaseException as e:
+        print(e)
         return 9999999
     else:
         ma_num = (sum(df['close_front'][i:]) + data[stock]['lastPrice']) / num
@@ -145,9 +147,10 @@ def ma_1(stock, num):
     global engine_stock
     i = num * -1
     try:
-        df = pd.read_sql_query(
-            'select close_front from `%s_1d`' % stock, engine_stock)
-    except BaseException:
+        df = pd.read_sql_query(text(
+            'select close_front from `%s_1d`' % stock), engine_stock.connect())
+    except BaseException as e:
+        print(e)
         return 9999999
     else:
         ma_num_1 = df['close_front'][i:].mean()
@@ -158,8 +161,8 @@ def his_vol(stock, num):
     global engine_stock
     num = num * -1
     try:
-        df = pd.read_sql_query(
-            'select volume_front from `%s_1d`' % stock, engine_stock)
+        df = pd.read_sql_query(text(
+            'select volume_front from `%s_1d`' % stock), engine_stock.connect())
     except BaseException:
         return 9999999
     else:
@@ -176,8 +179,8 @@ def ma_judge(data, list_judge, rate, results):
         MA5_1 = ma_1(stock, 5)
         # print(i, current_price, open_price, MA5, MA10, MA20, MA5_1)
         # 入交易池标准:阳线\大于MA5\MA5向上\MA20<MA10\离120线有距离
-        if (current_price > open_price) & (current_price > MA5) & (MA5 > MA5_1) & (current_price < MA5 * 1.03) & (
-                MA20 < MA10) & (current_price > MA120 or current_price < MA120 * rate):
+        if (current_price > open_price) & (current_price > MA5) & (MA5 > MA5_1) & (current_price < MA5 * 1.05) \
+                & (current_price > MA120 or current_price < MA120 * rate):
             if his_vol(stock, -1) > his_vol(stock, -2):
                 results.append(stock.replace('SH', 'XSHG').replace('SZ', 'XSHE'))
 
@@ -217,22 +220,28 @@ def buy_trader(data):
     # print('买入函数:', dt.now(), f'接受到{len(data.keys())}个个股')
     results = mp.Manager().list()
     mp_list = []
-    engine_hlfx_pool = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/hlfx_pool?charset=utf8')
+    engine_hlfx_pool = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/hlfx_pool?charset=utf8',
+                                     pool_size=4000, pool_recycle=50, max_overflow=-1)
 
     try:
         stock_pool = pd.read_sql_query(
-            'select value from `%s` order by `index` desc limit 10' % 'daily_1d', engine_hlfx_pool)
+            text('select value from `%s` order by `index` desc limit 10' % '1d'), engine_hlfx_pool.connect())
         stock_pool = stock_pool.iloc[0, 0].split(",")
         stock_pool.sort()
-        # print('stock_pool', len(stock_pool))
-    except BaseException:
-        pass
+        print('stock_pool', len(stock_pool))
 
-    list_judge = list(set(data.keys()) & set(stock_pool))
-    print(f'本轮有{len(data.keys())}条个股信息,而list_judge有:{len(list_judge)}')
+    except BaseException as e:
+        print(e)
+
+    if len(stock_pool)!=0:
+        list_judge = list(set(data.keys()) & set(stock_pool))
+        print(f'本轮有{len(data.keys())}条个股信息,而list_judge有:{len(list_judge)}')
+    else:
+        print(f'stock_pool为{len(stock_pool)}个')
     step = math.ceil(len(list_judge) / 4)
     rate = 0.8
     if len(list_judge) != 0:
+        print(f'list_judge:{list_judge}')
         for i in range(0, len(list_judge), step):
             p = mp.Process(target=ma_judge, args=(data, list_judge[i:i + step], rate, results))
             mp_list.append(p)
@@ -243,6 +252,7 @@ def buy_trader(data):
 
     # 选择板块
     if len(results) != 0:
+        print(f'进入板块选择{results}')
         # 基本面过滤
         results = get_fundamentals(results)
         num_industry = get_industry(results)
@@ -311,7 +321,7 @@ def buy_trader(data):
                         print(f'Cash只有:{cash} 或者 现有持仓{len(positions_dict)} 超过了{max_pos}')
                 else:
                     print(f'{stock}已持仓!')
-            engine_hlfx_pool.dispose()
+    engine_hlfx_pool.dispose()
     print('一轮结束了,现在时间是:', dt.now())
 
 

+ 3 - 2
QMT/download_data_whole.py

@@ -17,7 +17,8 @@ path = 'C:\\qmt\\userdata_mini'
 
 field = ['time', 'open', 'close', 'high', 'low', 'volume', 'amount']
 cpu_count = mp.cpu_count()
-eng_w = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8')
+eng_w = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8',
+                      pool_recycle=3600, pool_pre_ping=True, pool_size=100)
 
 
 def err_call_back(err):
@@ -80,7 +81,7 @@ if __name__ == '__main__':
     pus = psutil.Process()
     # pus.cpu_affinity([12, 13, 14, 15, 16, 17, 18, 19])
 
-    # download_data()
+    download_data()
 
     scheduler = BlockingScheduler()
     scheduler.add_job(func=download_data, trigger='cron', day_of_week='0-4', hour='20', minute='05',

+ 10 - 9
QMT/qmt_get_indicators.py

@@ -17,7 +17,8 @@ from apscheduler.schedulers.blocking import BlockingScheduler
 import psutil
 
 pd.set_option('display.max_columns', None)  # 设置显示最大行
-engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8')
+engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8',
+                       pool_size=4000, pool_recycle=3600, max_overflow=1000, pool_timeout=60)
 
 
 def err_call_back(err):
@@ -118,9 +119,9 @@ def get_hlfx(data):
             # 底
             # 符合底分型形态,且第2、3根k线是阳线
             if ((df_day.loc[x, 'high'] > df_day.loc[x - 1, 'high']) and
-                (df_day.loc[x - 2, 'high'] > df_day.loc[x - 1, 'high'])) and \
-                    df_day.loc[x, 'close'] > df_day.loc[x, 'open'] and \
-                    df_day.loc[x - 1, 'close'] > df_day.loc[x - 1, 'open']:
+                (df_day.loc[x - 2, 'high'] > df_day.loc[x - 1, 'high'])):
+                # and df_day.loc[x, 'close'] > df_day.loc[x, 'open'] and \
+                #     df_day.loc[x - 1, 'close'] > df_day.loc[x - 1, 'open']:
 
                 df_day.loc[x, 'HL'] = 'L*'
 
@@ -221,12 +222,11 @@ def get_hlfx(data):
 
 def tech_anal(stocks, hlfx_pool, hlfx_pool_daily, err_list):
     print(f'{dt.now()}开始循环计算! MyPid is {os.getpid()},池子长度为{len(stocks)}')
-
-    engine_tech = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8',
-                                pool_recycle=60, max_overflow=-1)
     m = 0
 
     for stock in stocks:
+        engine_tech = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8',
+                                    pool_size=4000, pool_recycle=3600, max_overflow=1000, pool_timeout=60)
         # print(stock)
         try:
             df = pd.read_sql_table('%s_1d' % stock, con=engine.connect())
@@ -268,6 +268,7 @@ def tech_anal(stocks, hlfx_pool, hlfx_pool_daily, err_list):
             elif stock not in hlfx_pool and T_signals == 1:
                 hlfx_pool.append(stock)
                 hlfx_pool_daily.append(stock)
+        engine_tech.dispose()
 
 
     print(f'Pid:{os.getpid()}已经完工了,应处理{len(stocks)},共计算{m}支个股')
@@ -283,7 +284,7 @@ def ind():
     err_list = mp.Manager().list()
     fre = '1d'
     engine_hlfx_pool = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/hlfx_pool?charset=utf8',
-                                     pool_recycle=3600, pool_pre_ping=True)
+                                     pool_size=4000, pool_recycle=3600, max_overflow=1000, pool_timeout=60)
     hlfx_pool = mp.Manager().list()
     hlfx_pool_daily = mp.Manager().list()
     hlfx_pool.extend(pd.read_sql_query(
@@ -350,4 +351,4 @@ if __name__ == '__main__':
     try:
         scheduler.start()
     except (KeyboardInterrupt, SystemExit):
-        pass
+        pass

+ 25 - 26
QMT/qmt_real_hlfx.py

@@ -2,7 +2,7 @@
 # from jqdatasdk import *
 import pandas as pd
 import pymysql
-from sqlalchemy import create_engine
+from sqlalchemy import create_engine, text
 import threading
 from datetime import datetime as dt
 import datetime
@@ -100,18 +100,17 @@ def err_call_back(err):
     traceback.print_exc()
 
 
-def run(seq, pid):
+def run(seq):
     mor = datetime.datetime.strptime(
         str(dt.now().date()) + '11:30', '%Y-%m-%d%H:%M')
     afternoon = datetime.datetime.strptime(
         str(dt.now().date()) + '15:00', '%Y-%m-%d%H:%M')
     mor_1 = datetime.datetime.strptime(
-        str(dt.now().date()) + '12:59', '%Y-%m-%d%H:%M')
+        str(dt.now().date()) + '11:10', '%Y-%m-%d%H:%M')
     """阻塞线程接收行情回调"""
     import time
     client = xtdata.get_client()
     while True:
-        time.sleep(3)
         now_date = dt.now()
         if not client.is_connected():
             xtdata.unsubscribe_quote(seq)
@@ -127,8 +126,8 @@ def run(seq, pid):
             print(f'现在时间:{dt.now()},已收盘')
             sys.exit()
             break
-            # return 0
-    # return
+
+    return
 
 
 def hlfx(stock_list, data):
@@ -136,20 +135,22 @@ def hlfx(stock_list, data):
     print(f'def-->hlfx, MyPid is {os.getpid()}, 本次我需要计算{len(stock_list)},now is {dt.now()}')
 
     # 获得hlfx_pool池子
-    engine_hlfx_pool = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/hlfx_pool?charset=utf8')
+    engine_hlfx_pool = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/hlfx_pool?charset=utf8',
+                                     pool_size=100, pool_recycle=3600, max_overflow=50, pool_timeout=60)
     results = []
-    results.extend(pd.read_sql_query(
-        'select value from `%s` order by `index` desc limit 10' % fre, engine_hlfx_pool).iloc[0, 0].split(","))
+    results.extend(pd.read_sql_query(text(
+        'select value from `%s` order by `index` desc limit 10' % fre), engine_hlfx_pool.connect()).iloc[0, 0].split(","))
     print(f'本次hlfx_pool有{len(results)}个个股')
 
-    engine_stock = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8')
+    engine_stock = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8',
+                                 pool_size=100, pool_recycle=3600, max_overflow=50, pool_timeout=60)
 
     for qmt_stock in stock_list:
         # 读取qmt_stocks_whole表-前复权-信息
         try:
-            df_day = pd.read_sql_query(
+            df_day = pd.read_sql_query(text(
                 'select time, open_front, close_front, high_front, low_front, volume_front, amount_front, '
-                'dif, dea, macd, HL from `%s_%s`' % (qmt_stock, fre), engine_stock)
+                'dif, dea, macd, HL from `%s_%s`' % (qmt_stock, fre)), engine_stock.connect())
             df_day.columns = ['time', 'open', 'close', 'high', 'low', 'volume', 'amount', 'dif', 'dea', 'macd', 'HL']
         except BaseException as e:
             print(qmt_stock, '未能读取!', e)
@@ -275,7 +276,7 @@ def hlfx(stock_list, data):
                         if m == 0:
                             df_day.loc[x, 'HL'] = 'H'
                             results.remove(qmt_stock)
-    engine_stock.dispose()
+
 
     db_pool = pymysql.connect(host='localhost',
                               user='root',
@@ -288,20 +289,12 @@ def hlfx(stock_list, data):
     sql = "INSERT INTO %s (date,value) VALUES('%s','%s')" % (fre, dt.now().strftime('%Y-%m-%d %H:%M:%S'), results_list)
     cursor_pool.execute(sql)
     db_pool.commit()
-    print(f'{dt.now()}写入新的results{len(results_list)}个,hlfx_pool更新')
+    print(f'{dt.now()}写入新的results-{len(results_list)}个,hlfx_pool更新')
+    engine_stock.dispose()
     engine_hlfx_pool.dispose()
 
 
-def bridge():
-    pid = os.getpid()
-    print(f'bridge is {os.getpid()}, now is {dt.now()},开盘了')
-    stocks = xtdata.get_stock_list_in_sector('沪深A股')
-    seq = xtdata.subscribe_whole_quote(stocks, callback=prepare)
-    run(seq, pid)
-
-
 def prepare(data):
-    print(f'prepare is {os.getpid()}, now is {dt.now()},开盘了')
     stock_list = list(data.keys())
     if len(data.keys()) >= 12:
         cpu_count = 12
@@ -314,7 +307,6 @@ def prepare(data):
         to_hlfx_list.append([x for x in stock_list[i:i + step]])
 
     pool = mp.Pool(processes=cpu_count, maxtasksperchild=12)
-    print(len(to_hlfx_list))
     for m in range(len(to_hlfx_list)):
         pool.apply_async(func=hlfx,
                          args=(to_hlfx_list[m], data), error_callback=err_call_back)
@@ -322,6 +314,13 @@ def prepare(data):
     pool.join()
 
 
+def bridge():
+    print(f'bridge is {os.getpid()}, now is {dt.now()},开盘了')
+    stocks = xtdata.get_stock_list_in_sector('沪深A股')
+    seq = xtdata.subscribe_whole_quote(stocks, callback=prepare)
+    run(seq)
+
+
 def job_func():
     print(f"Job started at {dt.now()}")
     # 创建子进程
@@ -362,8 +361,8 @@ if __name__ == '__main__':
     scheduler = BlockingScheduler()
     scheduler.add_job(func=job_func, trigger='cron', day_of_week='0-4', hour='09', minute='25',
                       timezone="Asia/Shanghai", max_instances=5)
-    # scheduler.add_job(func=job_func, trigger='cron', day_of_week='0-4', hour='13', minute='00',
-    #                   timezone="Asia/Shanghai")
+    # # scheduler.add_job(func=job_func, trigger='cron', day_of_week='0-4', hour='13', minute='00',
+    # #                   timezone="Asia/Shanghai")
     try:
         scheduler.start()
     except (KeyboardInterrupt, SystemExit):

+ 4 - 4
backtrader/230505_bt.py

@@ -191,7 +191,7 @@ def to_df(lt):
         df.to_csv(f"/Users/daniel/Documents/策略/策略穷举{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True,
                   encoding='utf_8_sig', mode='w')
     else:
-        df.to_csv(f"C:\Daniel\策略\策略穷举{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True, encoding='utf_8_sig',
+        df.to_csv(f"C:\Daniel\策略\策略穷举_底分且均线扩散_rate低点{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True, encoding='utf_8_sig',
                   mode='w')
     print(f'结果:{df}')
 
@@ -199,10 +199,10 @@ def to_df(lt):
 def backtrader(list_date, table_list, result, result_change, result_change_fall, num, Volatility, rate, err_list):
     print(f'{num}天波动率为{Volatility}%MA5斜率为{rate}', 'myPID is ', os.getpid())
     sttime = dt.now()
-    engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8')
+    engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8',pool_size=4000)
     for stock in table_list:
         # print(stock)
-        stk_df = pd.read_sql_table(stock, engine)
+        stk_df = pd.read_sql_table(stock, engine.connect())
         stk_df.time = pd.to_datetime(stk_df.time)
         # stk_df = stk_df[stk_df['HL'] != '-']
         try:
@@ -319,7 +319,7 @@ if __name__ == '__main__':
     thread_list = []
     # pool = mp.Pool(processes=mp.cpu_count())
     pool = mp.Pool(processes=24)
-    for num in range(20, 200, 20):
+    for num in range(80, 200, 20):
         for Volatility in range(3, 13, 1):
             for rate in range(3, 13, 1):
                 # step = math.ceil(len(table_list) / mp.cpu_count())

+ 6 - 5
backtrader/230508_bt.py

@@ -194,18 +194,19 @@ def to_df(lt):
         df.to_csv(f"/Users/daniel/Documents/策略/策略穷举-均线粘连后底分型{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True,
                   encoding='utf_8_sig', mode='w')
     else:
-        df.to_csv(f"C:\Daniel\策略\策略穷举底分型_均线缠绕_只买一次{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True, encoding='utf_8_sig',
-                  mode='w')
-    print(f'结果:{df}')
+        df.to_csv(f"C:\Daniel\策略\策略穷举底分型_均线缠绕_只买一次{dt.now().strftime('%Y%m%d%H%m%S')}.csv", index=True,
+                  encoding='utf_8_sig', mode='w')
+    print(f'结果:, \n, {df}')
 
 
 def backtrader(list_date, table_list, result, result_change, result_change_fall, num, Volatility, rate, err_list):
     print(f'{num}天波动率为{Volatility}%MA5斜率为{rate}', 'myPID is ', os.getpid())
     sttime = dt.now()
-    engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8')
+    engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8',
+                           max_overflow=-1)
     for stock in table_list:
         # print(stock)
-        stk_df = pd.read_sql_table(stock, engine)
+        stk_df = pd.read_sql_table(stock, engine.connect())
         stk_df.time = pd.to_datetime(stk_df.time)
         # stk_df = stk_df[stk_df['HL'] != '-']
         try:

+ 100 - 0
docker.start.txt

@@ -19,3 +19,103 @@ docker run  -itd  -p 3307:3306 --name mysql8033 -e character-set-server=utf8mb4
 
 docker run  -itd  -p 3307:3306 --name mysql8033 -e character-set-server=utf8mb4 --privileged=true  --restart unless-stopped -v C:/docker_mysql/stock_data:/var/lib/mysql  -e MYSQL_ROOT_PASSWORD=r6kEwqWU9!v3  -d mysql:8.0.33 --lower_case_table_names=1 --skip-log-bin --disable-log-bin
 
+
+
+
+20230515
+docker run  -itd  -p 3307:3306 --name mysql8033 --privileged=true  --restart unless-stopped  -v C:/docker_mysql/stock_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=r6kEwqWU9!v3  -d mysql:8.0.33
+docker run  -itd  -p 3309:3306 --name mysqltest -e character-set-server=utf8mb4 --privileged=true  --restart unless-stopped   -e MYSQL_ROOT_PASSWORD=r6kEwqWU9!v3  -d mysql:8.0.33 --skip-log-bin --disable-log-bin --log-error=/var/lib/mysql/err.log
+
+
+
+# For advice on how to change settings please see
+# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
+
+[mysqld]
+#
+# Remove leading # and set to the amount of RAM for the most important data
+# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
+# innodb_buffer_pool_size = 128M
+#
+# Remove leading # to turn on a very important data integrity option: logging
+# changes to the binary log between backups.
+# log_bin
+#
+# Remove leading # to set options mainly useful for reporting servers.
+# The server defaults are faster for transactions and fast SELECTs.
+# Adjust sizes as needed, experiment to find the optimal values.
+# join_buffer_size = 128M
+# sort_buffer_size = 2M
+# read_rnd_buffer_size = 2M
+
+# Remove leading # to revert to previous value for default_authentication_plugin,
+# this will increase compatibility with older clients. For background, see:
+# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
+# default-authentication-plugin=mysql_native_password
+skip-log-bin
+disable-log-bin
+skip-host-cache
+skip-name-resolve
+datadir=/var/lib/mysql
+socket=/var/run/mysqld/mysqld.sock
+secure-file-priv=/var/lib/mysql-files
+user=mysql
+max_connections=10000
+max_user_connections=5000
+character-set-server=utf8mb4
+thread_stack=4096k
+innodb_log_file_size=200M
+
+pid-file=/var/run/mysqld/mysqld.pid
+[client]
+socket=/var/run/mysqld/mysqld.sock
+character-set-server=utf8mb4
+!includedir /etc/mysql/conf.d/
+
+
+
+
+
+# For advice on how to change settings please see
+# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
+
+[mysqld]
+#
+# Remove leading # and set to the amount of RAM for the most important data
+# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
+# innodb_buffer_pool_size = 128M
+#
+# Remove leading # to turn on a very important data integrity option: logging
+# changes to the binary log between backups.
+# log_bin
+#
+# Remove leading # to set options mainly useful for reporting servers.
+# The server defaults are faster for transactions and fast SELECTs.
+# Adjust sizes as needed, experiment to find the optimal values.
+# join_buffer_size = 128M
+# sort_buffer_size = 2M
+# read_rnd_buffer_size = 2M
+
+# Remove leading # to revert to previous value for default_authentication_plugin,
+# this will increase compatibility with older clients. For background, see:
+# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
+# default-authentication-plugin=mysql_native_password
+skip-host-cache
+skip-name-resolve
+datadir=/var/lib/mysql
+socket=/var/run/mysqld/mysqld.sock
+secure-file-priv=/var/lib/mysql-files
+log_error=/var/lib/mysql/error.log
+user=mysql
+max_connections=2000
+max_user_connections=1000
+max_connect_errors=1000000
+thread_cache_size=300
+server-id = 1
+character-set-server = utf8mb4
+
+pid-file=/var/run/mysqld/mysqld.pid
+[client]
+socket=/var/run/mysqld/mysqld.sock
+
+!includedir /etc/mysql/conf.d/