【解決済】ローカルDBにリストアしたらログインできなくなった。

本番MariaDBをダンプして、ローカルDBにリストアしたらログインできなくなった。

mysql> set password = '';
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted
mysql> SET PASSWORD FOR root = '';
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted
mysql> ALTER USER root IDENTIFIED BY '';
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted
mysql> set password for root@localhost=password('');
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted

テーブルのカラム数が合っておらず、破損している可能性を示唆

=> vagrant up --provisionで仮想マシンのプロビジョニングからやり直して、
=> DBユーザーのリセットしてみる。

プロビジョニングでこける

==> homestead_2nd: Running provisioner: Creating MySQL Database: [プロジェクトDB名] (shell)...
    homestead_2nd: Running: script: Creating MySQL Database: [プロジェクトDB名
    homestead_2nd: ERROR
    homestead_2nd:  1045 (28000)
    homestead_2nd: : Access denied for user 'homestead'@'localhost' (using password: YES)

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

[ファイル位置] Homsteadのscripts/create-mysql.sh

#!/usr/bin/env bash

cat > /root/.my.cnf << EOF
[client]
user = XXXX
password = XXXXXXXX
host = localhost
EOF

# user = homestead
# password = secret

cp /root/.my.cnf /home/vagrant/.my.cnf

DB=$1;

mysql -e "CREATE DATABASE IF NOT EXISTS \`$DB\` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci";

解決方法

$ mysql -u root -p mysql < LogicalBackups_3rd_on_DATE.sql

=> 無事に「$ mysql -u root」でパスワードなしログインに成功