[MDEV-22630] mysql_upgrade (MariaDB 5.2.X --> MariaDB 10.3.X) does not fix auth_string to change it to authentication_string Created: 2020-05-19  Updated: 2021-04-13  Resolved: 2020-12-19

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System, Upgrades
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.2.37, 10.3.28

Type: Bug Priority: Critical
Reporter: Pramod Mahto Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-21244 mysql_upgrade creating empty global_p... Closed

 Description   

As per KB link https://mariadb.com/kb/en/upgrading-between-major-mariadb-versions/

One can upgrade from MariaDB 5.5 to the latest MariaDB version without any trouble. All older versions should work too (as long as the storage engines you were using are still around). But found direct upgrade will not take care of data dictionary mysql.user table structure.

Newly installed MariaDB servers 10.3.22 have following in mysql.user

 
plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
`authentication_string` text COLLATE utf8_bin NOT NULL,

MariaDB servers direct upgrade from 5.2.12 to 10.3.22 (skipping 5.5.68 ) have a difference in mysql.user

`plugin` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`auth_string` text COLLATE utf8_bin NOT NULL,

Difference found mainly for Two columns while up-gradation from 5.2.X to 10.3.X while going through MariaDB 5.6.XX version.

Column name vary :-

plugin
auth_string
authentication_string

Considering authentication_string / auth_string

Fresh installation of 5.5.12 and 5.3.12

MariaDB [(none)]> desc mysql.user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field                 | Type                              | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| auth_string           | text                              | NO   |     | NULL    |       |
+-----------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 5.5.68

 
MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| auth_string            | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
  `auth_string` text COLLATE utf8_bin NOT NULL,

Column name "auth_string" continue till upgrading MariaDB 10.3.XX.

While fresh Installation of 5.5.68

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| authentication_string  | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `authentication_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 10.0.38

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| authentication_string  | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `authentication_string` text COLLATE utf8_bin NOT NULL,
  

column name "authentication_string" continue till upgrading to MariaDB 10.3.XX

For Plugin column data type change from MariaDB 5.6.XX version .

MariaDB 5.2.12 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field                 | Type                              | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| plugin                | char(60)                          | NO   |     |         |       |
| auth_string           | text                              | NO   |     | NULL    |       |
+-----------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
 `plugin` char(60) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 5.3.12 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field                 | Type                              | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| plugin                | char(60)                          | NO   |     |         |       |
| auth_string           | text                              | NO   |     | NULL    |       |
+-----------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `plugin` char(60) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 5.5.68 (plugin` char(64) taken care by mysql_upgrade)

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| plugin                 | char(64)                          | NO   |     |         |       |
| auth_string            | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 10.0.38 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field                  | Type                              | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| plugin                 | char(64)                          | NO   |     |         |       |
| auth_string            | text                              | NO   |     | NULL    |       |
+------------------------+-----------------------------------+------+-----+---------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 10.1.45 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+----------+-------+
| Field                  | Type                              | Null | Key | Default  | Extra |
+------------------------+-----------------------------------+------+-----+----------+-------+
| plugin                 | char(64)                          | NO   |     |          |       |
| auth_string            | text                              | NO   |     | NULL     |       |
+------------------------+-----------------------------------+------+-----+----------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
  `plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,
  

Upgrading to MariaDB 10.2.32 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+----------+-------+
| Field                  | Type                              | Null | Key | Default  | Extra |
+------------------------+-----------------------------------+------+-----+----------+-------+
| plugin                 | char(64)                          | NO   |     |          |       |
| auth_string            | text                              | NO   |     | NULL     |       |
+------------------------+-----------------------------------+------+-----+----------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
 `plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,

Upgrading to MariaDB 10.3.22 (No changes for below columns)

MariaDB [(none)]> desc mysql.user;
+------------------------+-----------------------------------+------+-----+----------+-------+
| Field                  | Type                              | Null | Key | Default  | Extra |
+------------------------+-----------------------------------+------+-----+----------+-------+
| plugin                 | char(64)                          | NO   |     |          |       |
| auth_string            | text                              | NO   |     | NULL     |       |
+------------------------+-----------------------------------+------+-----+----------+-------+
 
MariaDB [(none)]> show create table mysql.user\G
 
 `plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
  `auth_string` text COLLATE utf8_bin NOT NULL,



 Comments   
Comment by Valerii Kravchuk [ 2020-05-19 ]

Basically, see this in 10.4 (or later version:

https://github.com/MariaDB/server/blob/10.4/scripts/mysql_system_tables_fix.sql#L651

ALTER TABLE user CHANGE auth_string authentication_string TEXT NOT NULL;

and find similar line in any older version. It does NOT exist, so we have a bug in 5.5, 10.0., 10.1, 10.2 and 10,3 that prevents proper upgrade of mysql.user table with mysql_upgrade. The bug is in mysql_upgrade up to version 10.3 inclusive.

Comment by Valerii Kravchuk [ 2020-05-19 ]

KB page:

https://mariadb.com/kb/en/upgrading-between-major-mariadb-versions/

should be corrected to explain this problem (upgrades from 5.2 or 5.3 are problematic) until the bug is fixed.

Generated at Thu Feb 08 09:16:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.