How to duplicate a MySQL database on the same server

前端 未结 6 1920
不知归路
不知归路 2021-01-31 01:51

I have a large MySQL database, lets call it live_db, which I want to replicate on the same machine to provide a test system to play around with (test_db

6条回答
  •  北海茫月
    2021-01-31 02:06

    Michaels answer abowe works well but does not copy events, stored procedures or triggers.

    To copy those a few more switches is needed for mysqldump: --events --triggers --routines

    To complement an already made copy:

    mysqldump --user=username --password=passwd --no-data --no-create-info --no-create-db --events --triggers --routines live_db | mysql --user=username --password=passwd test_db

提交回复
热议问题