Make WordPress Core

Opened 11 months ago

Last modified 5 months ago

#58816 reopened defect (bug)

MariaDB 11.x: deprecated alias for MySQL

Reported by: javiercasares's profile JavierCasares Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:

Description

Since MariaDB 11.0, there is a “deprecated warning message”:

PHPUnitFrameworkException: mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead

mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead

One random test where you can find it:
https://make.wordpress.org/hosting/test-results/r56244/wpsaedgebot-r56244/

Change History (9)

#1 @SergeyBiryukov
11 months ago

Thanks for the ticket!

I have not found any direct reference to the mysql binary in WordPress core files, test suite, or in PHPUnit classes.

Perhaps there is a mysql=/usr/bin/mysql reference somewhere on the system that needs to be updated to /usr/bin/mariadb? Looking at the MariaDB upgrading docs, I wonder if that is done as part of uninstalling the old version and installing the new one.

#2 @JavierCasares
11 months ago

Mmm… I'm going to delete the server and reinstall it and check it.

Also, if it's not a WordPress problem, I'll talk to the MariaDB people to check if we can fix that directly from the outside. :)

#3 @JavierCasares
11 months ago

  • Resolution set to invalid
  • Status changed from new to closed

I found what's happening. It is something at the PHPUnit Test Runner. I'm going to open there a ticket :) and we can close this one.

#4 @SergeyBiryukov
11 months ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up!

At a glance, PHPUnit Test Runner does call the mysql binary directly, though it's not 100% clear to me yet whether that's the issue here.

#5 @JavierCasares
11 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

The Test-Runners calls "mysql --version" to get the MySQL version with a shell command.

The idea (I'm trying but doedn't get to work) is to change this shell question, to a "SELECT VERSION()".

As now (in a future) "mysql" doesn't works with "mariadb", we get the message as the alias won't work.

MariaDB 11.0 is checking the alias as "future deprecation" to stop using mysql as an alias. And in 1-2 versions it won't work, so we cannot get the SQL version from the shell command because will be tow separated programs (mysql and mariadb). The best way is to connect to the database and do a "SELECT VERSION()".

I've tried this function:

<?php
/**
 * Get SQL version
 */
function get_sql_version() {
  $database_version = null;
  $conn = new mysqli( getenv( 'WPT_DB_HOST' ), getenv( 'WPT_DB_USER' ), getenv( 'WPT_DB_PASSWORD' ), getenv( 'WPT_DB_NAME' ) );
  if ( !$conn->connect_error ) {
    $result = $conn->query( 'SELECT VERSION()' );
    if ( $result->num_rows > 0 ) {
      $row = $result->fetch_assoc();
      $database_version = $row['VERSION()'];
    }
  }
  $conn->close();
  return trim( (string) $database_version );
}

and changing...

<?php
'mysql_version'  => get_sql_version(),

But I cannot get that working (probably I'm doing something wrong testing it. I'm not expert with node and the testing part.

#6 @SergeyBiryukov
11 months ago

  • Milestone set to Awaiting Review

This ticket was mentioned in Slack in #hosting by javier. View the logs.


5 months ago

This ticket was mentioned in Slack in #hosting by crixu. View the logs.


5 months ago

Note: See TracTickets for help on using tickets.