How to Export & Import Existing User (with its Privileges!)

后端 未结 9 1981
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-03 17:01

I have an existing MySQL instance (test), containing 2 databases and a few users each having different access privileges to each database.

I now need to duplicate one of

9条回答
  •  悲&欢浪女
    2021-02-03 17:51

    I had the same problem. The solution is that after the import of the backup you need to do a "flush privileges;". Then the privileges of the users will be active as in the original database.

    SO

    mysql -u root -p -h localhost secondb < secondb_schema.sql

    mysql -u root; then in mysql: "flush privileges;"

提交回复
热议问题