Skip to content

Commit

Permalink
mysql 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Oct 9, 2023
1 parent 5532dcd commit 962b0fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/mariadb/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def initMariaDbPwd():
pwd + ' -e "drop database test";'
mw.execShell(drop_test_db)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))

# 删除冗余账户
hostname = mw.execShell('hostname')[0].strip()
if hostname != 'localhost':
Expand All @@ -412,8 +414,6 @@ def initMariaDbPwd():
drop_root_hostname = serverdir + '/bin/mysql --defaults-file=' + \
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
mw.execShell(drop_root_hostname)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
return True


Expand Down
3 changes: 2 additions & 1 deletion plugins/mysql-apt/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ def initMysql8Pwd():
pwd + ' -e "drop database test";'
mw.execShell(drop_test_db)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))

# 删除冗余账户
hostname = mw.execShell('hostname')[0].strip()
if hostname != 'localhost':
Expand All @@ -416,7 +418,6 @@ def initMysql8Pwd():
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
mw.execShell(drop_root_hostname)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
return True


Expand Down
4 changes: 2 additions & 2 deletions plugins/mysql-yum/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ def initMysql8Pwd():
pwd + ' -e "drop database test";'
mw.execShell(drop_test_db)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))

# 删除冗余账户
hostname = mw.execShell('hostname')[0].strip()
if hostname != 'localhost':
Expand All @@ -404,8 +406,6 @@ def initMysql8Pwd():
drop_root_hostname = cmd_my + ' --defaults-file=' + \
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
mw.execShell(drop_root_hostname)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
return True


Expand Down
4 changes: 2 additions & 2 deletions plugins/mysql/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ def initMysql8Pwd():
myconf + ' -uroot -p' + pwd + ' -e "drop database test";'
mw.execShell(drop_test_db)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))

# 删除冗余账户
hostname = mw.execShell('hostname')[0].strip()
if hostname != 'localhost':
Expand All @@ -520,8 +522,6 @@ def initMysql8Pwd():
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
mw.execShell(drop_root_hostname)

pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))

return True


Expand Down

0 comments on commit 962b0fa

Please sign in to comment.