patternModerate
MariaDB - MySQL - ALL-DB Import - Table 'user' already exists
Viewed 0 times
allusermariadbmysqlalreadyexiststableimport
Problem
I am attempting to migrate from local MariaDB to Docker version which should in essence be as simple as migrating to a new SQL Server. I have setup the Docker container fine via but can't seem to import my "all-databases" dump.
This is what I get:
Dump generated via :
Update: This is run on a fresh docker container each time and I have created backups in a directory that I am importing from.
Update2: Perhaps it's related to my docker setup?
Here is my docker cmd:
I am doing this import from the local machine, I have reproduced results from inside the container.
This is what I get:
mysql -u root -p < mariadb_alldb_*.sql
Enter password:
ERROR 1050 (42S01) at line 8022: Table 'user' already existsDump generated via :
mysqldump -u root -p --all-databases --skip-lock-tables > mariadb_alldb_"$(date '+%F')".sqlUpdate: This is run on a fresh docker container each time and I have created backups in a directory that I am importing from.
ls * | grep mariadb_alldb_
mariadb_alldb_2020-05-04.sqlUpdate2: Perhaps it's related to my docker setup?
Here is my docker cmd:
docker stop mariadb && docker rm mariadb
docker run -d --name="mariadb" \
-p 3306:3306 \
-e TZ="America/Whitehorse" \
-v "/opt/mariadb/conf/conf.d":"/etc/mysql/conf.d" \
-v "/opt/mariadb/backups":"/mnt/" \
--mount type=volume,dst=/var/run/mysqld,volume-driver=local,volume-opt=type=none,volume-opt=o=bind,volume-opt=device=/var/run/mysqld \
mariadb:latestI am doing this import from the local machine, I have reproduced results from inside the container.
Solution
As someone already mentioned, this has to do with the
The solution is to simply add the following two lines to the top of your
mysql.user table being changed to a view in 10.4. The problem and solution is documented on the MariaDB website in MDEV-22127.The solution is to simply add the following two lines to the top of your
all-dbs.sql dump file:DROP TABLE IF EXISTS `mysql`.`global_priv`;
DROP VIEW IF EXISTS `mysql`.`user`;Code Snippets
DROP TABLE IF EXISTS `mysql`.`global_priv`;
DROP VIEW IF EXISTS `mysql`.`user`;Context
StackExchange Database Administrators Q#266480, answer score: 12
Revisions (0)
No revisions yet.