I made an:
mysql_upgrade
No fix was made and the same problem is happening, but I think the mysql_upgrade was not was not required for because I didn't upgrade my mariadb. I just dump from other server and restored in my local computer.
The same test in my colleague laptop with same mariadb version is working OK.
Server version: 10.6.12-MariaDB-0ubuntu0.22.04.1-log Ubuntu 22.04
The problem seems to be happening just in my laptop. I can replay the same error with this code creating a new empty database:
$ mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.6.12-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database kk;
Query OK, 1 row affected (0,000 sec)
MariaDB [(none)]> use kk;
Database changed
MariaDB [kk]> CREATE TABLE `sessions_bak` (
-> `uid` int(10) unsigned NOT NULL COMMENT 'The users.uid corresponding to a session, or 0 for anonymous user.',
-> `sid` varchar(128) NOT NULL COMMENT 'A session ID. The value is generated by Drupal’s session handlers.',
-> `ssid` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secure session ID. The value is generated by Drupal’s session handlers.',
-> `hostname` varchar(128) NOT NULL DEFAULT '' COMMENT 'The IP address that last used this session ID (sid).',
-> `timestamp` int(11) NOT NULL DEFAULT 0 COMMENT 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.',
-> `cache` int(11) NOT NULL DEFAULT 0 COMMENT 'The time of this user’s last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get().',
-> `session` longblob DEFAULT NULL COMMENT 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
-> PRIMARY KEY (`sid`,`ssid`),
-> KEY `timestamp` (`timestamp`),
-> KEY `uid` (`uid`),
-> KEY `ssid` (`ssid`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='Drupal’s session handlers read and write into the...';
Query OK, 0 rows affected (0,033 sec)
MariaDB [kk]> ALTER TABLE `sessions_bak` DROP PRIMARY KEY;
ERROR 1025 (HY000): Error on rename of './kk/sessions_bak' to './kk/#sql-backup-a9b7-25' (errno: 168 "Unknown (generic) error from engine")
solanas → created an issue.
Upgrading from 7.95 to 7.98 I get this error from MarÃaDB with this step system_update_7086:
ERROR 1025 (HY000): Error on rename of './drupal7udima/sessions' to './drupal7udima/#sql-backup-1e057-47' (errno: 168 "Unknown (generic) error from engine")
Server version: 10.6.12-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04
The same occurs with cli:
MariaDB [(none)]> ALTER TABLE `drupal7udima`.`sessions` DROP PRIMARY KEY;
ERROR 1025 (HY000): Error on rename of './drupal7udima/sessions' to './drupal7udima/#sql-backup-1fe5d-c2' (errno: 168 "Unknown (generic) error from engine")
But this other command, dropping and adding the primary key in the same command works:
MariaDB [(none)]> ALTER TABLE `drupal7udima`.`sessions` DROP PRIMARY KEY, ADD PRIMARY KEY (`sid`,`ssid`);
Query OK, 0 rows affected (0,021 sec)
Records: 0 Duplicates: 0 Warnings: 0
The same upgrade (same drupal database and content) with a previous MariaDB is working OK.
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11