How to export user permissions in mysql

coldplay.xixi
Release: 2020-10-19 16:37:26
Original
3149 people have browsed it

mysql导出用户权限的方法:首先生成用户权限的脚本;然后生成权限SQL脚本;最后在目标服务器上执行脚本,代码为【mysql -uname -ppwd

How to export user permissions in mysql

mysql导出用户权限的方法:

在对MySQL数据库进行迁移的时候,有时候也需要迁移源数据库内的用户与权限。对于这个迁移我们可以从mysql.user表来获取用户的相关权限来生成相应的SQL语句,然后在目标服务器上来执行生成的SQL语句即可。本文提供了生成提取用户权限的脚本并给出演示。

1、生成用户权限的脚本

a400c1c758c6c362cfa8819b9529f0eb

需要注意:

a、目标服务上为非空服务器,已经存在一些账户及权限应考虑会覆盖的问题。

b、如果仅仅需要迁移非root用户,可以在原脚本中添加过滤条件,即 where user<>'root' 。

更多相关免费学习推荐:mysql教程(视频)

The above is the detailed content of How to export user permissions in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!