سؤال

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 TABLESuserWRITE; INSERT INTOuserVALUES ... ; 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(...)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top