How to dump / restore mysql.user [closed]
سؤال
I'm able to dump the table of users from one server with
mysqldump -u root -p -h [host address] mysql user > user_table_dump.sql
but how can I restore these users into my localhost enviroment? I tried without success:
mysql -u root -p mysql.user < user_table_dump.sql
mysql -u root -p mysql user < user_table_dump.sql
mysqldump -u root -p -h localhost mysql user < user_table_dump.sql
المحلول
Following the comment by Akina:
Edit dump file, remove all DDL statements from it. Restore data only -
LOCK TABLES
userWRITE; INSERT INTO
userVALUES ... ; UNLOCK TABLES;
.
I did it by taking only the data saved on the file and insert them into mysql.user like
INSERT INTO mysql.user VALUES(...)
لا تنتمي إلى dba.stackexchange