Re-assign host access permission to MySQL user

前端 未结 6 2319
情歌与酒
情歌与酒 2020-12-12 14:03

I have several thousand MySQL users all set to allow access from a specific host. The problem is that now I\'m going to have two machines (more in the future) which will nee

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 15:05

    The accepted answer only renamed the user but the privileges were left behind.

    I'd recommend using:

    RENAME USER 'foo'@'1.2.3.4' TO 'foo'@'1.2.3.5';
    

    According to MySQL documentation:

    RENAME USER causes the privileges held by the old user to be those held by the new user.

提交回复
热议问题