diff --git a/plugins/mysql/conf/my.cnf b/plugins/mysql/conf/my.cnf index 2df4d69da..946b83079 100644 --- a/plugins/mysql/conf/my.cnf +++ b/plugins/mysql/conf/my.cnf @@ -5,6 +5,9 @@ port = 3306 socket = {$SERVER_APP_PATH}/mysql.sock [mysqld] +sha256_password_private_key_path=mysql.pem +sha256_password_public_key_path=mysql.pub + pid-file = {$SERVER_APP_PATH}/data/mysql.pid user = mysql port = 3306 @@ -80,6 +83,7 @@ innodb_max_dirty_pages_pct = 90 innodb_read_io_threads = 1 innodb_write_io_threads = 1 innodb_file_per_table=1 +innodb_large_prefix = 1 secure-file-priv={$SERVER_APP_PATH}/tmp diff --git a/plugins/mysql/conf/my5.7.cnf b/plugins/mysql/conf/my5.7.cnf index 78e9ce773..5b8efc7df 100644 --- a/plugins/mysql/conf/my5.7.cnf +++ b/plugins/mysql/conf/my5.7.cnf @@ -6,6 +6,9 @@ socket = {$SERVER_APP_PATH}/mysql.sock default-character-set = UTF8MB4 [mysqld] +sha256_password_private_key_path=mysql.pem +sha256_password_public_key_path=mysql.pub + pid-file = {$SERVER_APP_PATH}/data/mysql.pid user = mysql port = 3306 diff --git a/plugins/mysql/conf/my8.0.cnf b/plugins/mysql/conf/my8.0.cnf index 8668373de..83e601070 100644 --- a/plugins/mysql/conf/my8.0.cnf +++ b/plugins/mysql/conf/my8.0.cnf @@ -6,7 +6,10 @@ socket = {$SERVER_APP_PATH}/mysql.sock default-character-set = UTF8MB4 [mysqld] +sha256_password_private_key_path=mysql.pem +sha256_password_public_key_path=mysql.pub default_authentication_plugin=mysql_native_password + pid-file = {$SERVER_APP_PATH}/data/mysql.pid user = mysql port = 3306 diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 52157e3cf..fb7023a7d 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -146,6 +146,26 @@ def pMysqlDb(): return db +def makeInitRsaKey(version=''): + datadir = getServerDir() + "/data" + + mysql_pem = datadir + "/mysql.pem" + if not os.path.exists(mysql_pem): + rdata = mw.execShell( + 'cd ' + datadir + ' && openssl genrsa -out mysql.pem 1024') + # print(data) + rdata = mw.execShell( + 'cd ' + datadir + ' && openssl rsa -in mysql.pem -pubout -out mysql.pub') + # print(rdata) + + if not mw.isAppleSystem(): + mw.execShell('cd ' + datadir + ' && chmod 400 mysql.pem') + mw.execShell('cd ' + datadir + ' && chmod 444 mysql.pub') + + mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pem') + mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pub') + + def initDreplace(version=''): initd_tpl = getInitdTpl(version) @@ -486,8 +506,11 @@ def my8cmd(version, method): def appCMD(version, action): if version == '8.0' or version == '5.7': - return my8cmd(version, action) - return myOp(version, action) + status = my8cmd(version, action) + else: + status = myOp(version, action) + makeInitRsaKey(version) + return status def start(version=''):