diff --git a/agent/bench.py b/agent/bench.py index 7e6d5ce7..3166b923 100644 --- a/agent/bench.py +++ b/agent/bench.py @@ -266,7 +266,7 @@ def create_mariadb_user(self, site, mariadb_root_password, database=None): "FLUSH PRIVILEGES", ] for query in queries: - command = f"mysql -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' + command = f"mariadb -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' self.execute(command) return database, user, password @@ -279,7 +279,7 @@ def drop_mariadb_user(self, site, mariadb_root_password, database=None): "FLUSH PRIVILEGES", ] for query in queries: - command = f"mysql -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' + command = f"mariadb -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' self.execute(command) def fetch_monitor_data(self): diff --git a/agent/database_server.py b/agent/database_server.py index 395f0f43..bb8c6140 100644 --- a/agent/database_server.py +++ b/agent/database_server.py @@ -36,7 +36,7 @@ def search_binary_log( log = os.path.join(self.mariadb_directory, log) LINES_TO_SKIP = r"^(USE|COMMIT|START TRANSACTION|DELIMITER|ROLLBACK|#)" command = ( - f"mysqlbinlog --short-form --database {database} " + f"mariadb-binlog --short-form --database {database} " f"--start-datetime '{start_datetime}' " f"--stop-datetime '{stop_datetime}' " f" {log} | grep -Piv '{LINES_TO_SKIP}'" diff --git a/agent/proxysql.py b/agent/proxysql.py index 077469ad..c939a6d8 100644 --- a/agent/proxysql.py +++ b/agent/proxysql.py @@ -18,7 +18,7 @@ def __init__(self, directory=None): def proxysql_execute(self, command): command = ( - "mysql -h 127.0.0.1 -P 6032 " + "mariadb -h 127.0.0.1 -P 6032 " f"-u frappe -p{self.proxysql_admin_password} " f"--disable-column-names -e '{command}'" ) diff --git a/agent/site.py b/agent/site.py index cebd5f15..06d07824 100644 --- a/agent/site.py +++ b/agent/site.py @@ -250,7 +250,7 @@ def create_database_access_credentials(self, mode, mariadb_root_password): "FLUSH PRIVILEGES", ] for query in queries: - command = f"mysql -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' + command = f"mariadb -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' self.execute(command) return {"database": database, "user": user, "password": password} @@ -263,7 +263,7 @@ def revoke_database_access_credentials(self, user, mariadb_root_password): "FLUSH PRIVILEGES", ] for query in queries: - command = f"mysql -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' + command = f"mariadb -h {self.host} -uroot -p{mariadb_root_password}" f' -e "{query}"' self.execute(command) return {} @@ -291,7 +291,7 @@ def restore_site_tables(self): output = self.execute( "set -o pipefail && " f"gunzip -c '{backup_file_path}' | " - f"mysql -h {self.host} -u {self.user} -p{self.password} " + f"mariadb -h {self.host} -u {self.user} -p{self.password} " f"{self.database}", executable="/bin/bash", ) @@ -441,7 +441,7 @@ def tablewise_backup(self): backup_file = os.path.join(self.backup_directory, f"{table}.sql.gz") output = self.execute( "set -o pipefail && " - "mysqldump --single-transaction --quick --lock-tables=false " + "mariadb-dump --single-transaction --quick --lock-tables=false " f"-h {self.host} -u {self.user} -p{self.password} " f"{self.database} '{table}' " f" | gzip > '{backup_file}'", @@ -523,7 +523,7 @@ def _restore_touched_tables(self): output = self.execute( "set -o pipefail && " f"gunzip -c '{backup_file}' | " - f"mysql -h {self.host} -u {self.user} -p{self.password} " + f"mariadb -h {self.host} -u {self.user} -p{self.password} " f"{self.database}", executable="/bin/bash", ) @@ -538,7 +538,7 @@ def drop_new_tables(self): data = {"dropped": {}} for table in new_tables: output = self.execute( - f"mysql -h {self.host} -u {self.user} -p{self.password} " + f"mariadb -h {self.host} -u {self.user} -p{self.password} " f"{self.database} -e 'DROP TABLE `{table}`'" ) data["dropped"][table] = output @@ -620,7 +620,7 @@ def timezone(self): ) try: timezone = self.execute( - f"mysql -h {self.host} -u{self.database} -p{self.password} " + f"mariadb -h {self.host} -u{self.database} -p{self.password} " f'--connect-timeout 3 -sN -e "{query}"' )["output"].strip() except Exception: @@ -630,7 +630,7 @@ def timezone(self): @property def tables(self): return self.execute( - "mysql --disable-column-names -B -e 'SHOW TABLES' " + "mariadb --disable-column-names -B -e 'SHOW TABLES' " f"-h {self.host} -u {self.user} -p{self.password} {self.database}" )["output"].split("\n") @@ -662,7 +662,7 @@ def optimize_tables(self): for table in tables: query = f"OPTIMIZE TABLE `{table}`" self.execute( - f"mysql -sN -h {self.host} -u{self.user} -p{self.password}" f" {self.database} -e '{query}'" + f"mariadb -sN -h {self.host} -u{self.user} -p{self.password}" f" {self.database} -e '{query}'" ) def fetch_latest_backup(self, with_files=True): @@ -726,7 +726,7 @@ def get_database_size(self): f' WHERE `table_schema` = "{self.database}"' " GROUP BY `table_schema`" ) - command = f"mysql -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" + command = f"mariadb -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" database_size = self.execute(command).get("output") try: @@ -772,7 +772,7 @@ def get_database_free_size(self): f' WHERE `table_schema` = "{self.database}"' " GROUP BY `table_schema`" ) - command = f"mysql -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" + command = f"mariadb -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" database_size = self.execute(command).get("output") try: @@ -790,7 +790,7 @@ def get_database_free_tables(self): " AND ((`data_free` / (`data_length` + `index_length`)) > 0.2" " OR `data_free` > 100 * 1024 * 1024)" ) - command = f"mysql -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" + command = f"mariadb -sN -h {self.host} -u{self.user} -p{self.password}" f" -e '{query}'" output = self.execute(command).get("output") return [line.split("\t") for line in output.splitlines()] except Exception: