@@ -399,7 +399,7 @@ public function cli( $_, $assoc_args ) {
399
399
400
400
$ command = sprintf (
401
401
'%s%s --no-auto-rehash ' ,
402
- Utils \get_mysql_binary_path (),
402
+ $ this -> get_mysql_command (),
403
403
$ this ->get_defaults_flag_string ( $ assoc_args )
404
404
);
405
405
WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -502,7 +502,7 @@ public function query( $args, $assoc_args ) {
502
502
503
503
$ command = sprintf (
504
504
'%s%s --no-auto-rehash ' ,
505
- Utils \get_mysql_binary_path (),
505
+ $ this -> get_mysql_command (),
506
506
$ this ->get_defaults_flag_string ( $ assoc_args )
507
507
);
508
508
WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -741,7 +741,7 @@ private function get_posts_table_charset( $assoc_args ) {
741
741
list ( $ stdout , $ stderr , $ exit_code ) = self ::run (
742
742
sprintf (
743
743
'%s%s --no-auto-rehash --batch --skip-column-names ' ,
744
- Utils \get_mysql_binary_path (),
744
+ $ this -> get_mysql_command (),
745
745
$ this ->get_defaults_flag_string ( $ assoc_args )
746
746
),
747
747
[ 'execute ' => $ query ],
@@ -830,7 +830,7 @@ public function import( $args, $assoc_args ) {
830
830
831
831
$ command = sprintf (
832
832
'%s%s --no-auto-rehash ' ,
833
- Utils \get_mysql_binary_path (),
833
+ $ this -> get_mysql_command (),
834
834
$ this ->get_defaults_flag_string ( $ assoc_args )
835
835
);
836
836
WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
@@ -1766,7 +1766,7 @@ protected function run_query( $query, $assoc_args = [] ) {
1766
1766
self ::run (
1767
1767
sprintf (
1768
1768
'%s%s --no-auto-rehash ' ,
1769
- Utils \get_mysql_binary_path (),
1769
+ $ this -> get_mysql_command (),
1770
1770
$ this ->get_defaults_flag_string ( $ assoc_args )
1771
1771
),
1772
1772
array_merge ( [ 'execute ' => $ query ], $ mysql_args )
@@ -2167,7 +2167,7 @@ protected function get_current_sql_modes( $assoc_args ) {
2167
2167
list ( $ stdout , $ stderr , $ exit_code ) = self ::run (
2168
2168
sprintf (
2169
2169
'%s%s --no-auto-rehash --batch --skip-column-names ' ,
2170
- Utils \get_mysql_binary_path (),
2170
+ $ this -> get_mysql_command (),
2171
2171
$ this ->get_defaults_flag_string ( $ assoc_args )
2172
2172
),
2173
2173
array_merge ( $ args , [ 'execute ' => 'SELECT @@SESSION.sql_mode ' ] ),
@@ -2199,6 +2199,15 @@ protected function get_current_sql_modes( $assoc_args ) {
2199
2199
return $ modes ;
2200
2200
}
2201
2201
2202
+ /**
2203
+ * Returns the correct `mysql` command based on the detected database type.
2204
+ *
2205
+ * @return string The appropriate check command.
2206
+ */
2207
+ private function get_mysql_command () {
2208
+ return 'mariadb ' === Utils \get_db_type () ? 'mariadb ' : 'mysql ' ;
2209
+ }
2210
+
2202
2211
/**
2203
2212
* Returns the correct `check` command based on the detected database type.
2204
2213
*
0 commit comments