def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() if cursor: cursor.execute('SHOW GLOBAL VARIABLES LIKE \'log_error_verbosity\';') dir = cursor.fetchone() if dir and dir[1] != 2 and dir[1] != 3: mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'log-error_verbosity', '2')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() if cursor: cursor.execute( 'SHOW VARIABLES WHERE Variable_name = \'master_info_repository\';') dir = cursor.fetchone() if dir and dir[1] == 'FILE': mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'master_info_repository', 'TABLE')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() if cursor: cursor.execute( 'SHOW VARIABLES WHERE Variable_name = \'local_infile\';') dir = cursor.fetchone() if dir and dir[1] == 'ON': mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'local-infile', '0')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() if cursor: cursor.execute('SHOW variables LIKE \'log_error\';') dir = cursor.fetchone() if not dir[1]: mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'log-error', '/var/log/mysql/error.log')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() if cursor: cursor.execute('SHOW VARIABLES LIKE \'default_password_lifetime\';') dir = cursor.fetchone() # cursor only contains 1 record if dir and dir[1] < 90: # cursor only contains 1 record cursor.execute('SET GLOBAL default_password_lifetime=90') mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'default_password_lifetime', '90')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() flag = True if cursor: cursor.execute('SHOW variables LIKE \'have_symlink\';') dir = cursor.fetchone() if dir and dir[1] != 'DISABLED': mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'skip_symbolic_links', 'YES')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() flag = True if cursor: cursor.execute( 'SHOW GLOBAL VARIABLES WHERE Variable_name = \'secure_file_priv\' AND Value<>\'\';' ) for dir in cursor: # cursor only contains 1 record if not dir[1]: mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'secure_file_priv', '/var/lib/mysql-files/')
def fix(username, password): connection = helper.connectToMysql(username, password) cursor = connection.cursor() flag = True if cursor: cursor.execute('SHOW VARIABLES LIKE \'sql_mode\';') dir = cursor.fetchone() if dir and dir[1]: match = re.search('STRICT_ALL_TABLES', dir[1]) if not match: mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'sql_mode', dir[1] + ',STRICT_ALL_TABLES')
def fix(username, password): mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'skip-grant-tables', 'FALSE')
def fix(username, password): mysqlDefConf = '/etc/mysql/mysql.conf.d/mysqld.cnf' helper.fixConfFile(mysqlDefConf, 'log-raw', 'OFF')