coreserver は共用サーバーなので、色々と制約があります。root は使えません。
ライブラリーのインストール
mkdir my-space
python3 -m pip install mysql-connector --target ~/my-space
Collecting mysql-connector
サンプルプログラム
server_version.py
#! /usr/bin/python3
#
import sys
#
sys.path.append('/virtual/example/my-space')
import mysql.connector
print ("*** start ***")
#
host_aa='localhost'
user_aa ='scott'
password_aa = 'tiger'
data_base = 'city'
conn = mysql.connector.connect(user=user_aa, password=password_aa, \
host=host_aa,database=data_base)
#
cursor = conn.cursor()
#
cursor.execute("SELECT VERSION ()")
#
row = cursor.fetchone()
print(row[0])
#
cursor.close()
conn.close()
#
print("*** end ***")
実行結果
$ ./server_version.py
*** start ***
5.7.29-log
*** end ***