Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of exporting user rights by mysql

Shulou Source: shulou.com Published: 2022-06-01 02:29:25 10月30日 Update

Editor to share with you the method of mysql to export user rights, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Mysql method to export user rights: first generate a script for user rights; then generate a permission SQL script; finally, execute the script on the target server with the code [mysql-uname-ppwd. / grants.sql]

2. Generate permission SQL script

[root@HKBO ~] # / exp_grant.sh [root@HKBO ~] # head grants.sql-- Grants for root@127.0.0.1 GRANT ALL PRIVILEGES ON *. * TO 'root'@'127.0.0.1' IDENTIFIED BY PASSWORD' * EB3EA446C759C9DA93F84FCB56430DBEF051A9DD' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON `CNBO0815`. * TO 'root'@'127.0.0.1' WITH GRANT OPTION -- Grants for root@172.16.10.% GRANT ALL PRIVILEGES ON *. * TO 'root'@'172.16.10.%' IDENTIFIED BY PASSWORD' * 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9;-- Grants for CNBO@192.168.1.% GRANT USAGE ON *. * TO 'CNBO'@'192.168.1.%' IDENTIFIED BY PASSWORD' * ABD91BAD4A3448428563952E281015B237310EA8';. -- Author: Leshami--Blog: http://blog.csdn.net/leshami

3. Execute the script on the target server

The generated script can be executed on the target server.

Mysql-uname-ppwd

Tags: Permissions users scripts generation services servers goals methods content data databases articles statements not much code most of the time more sometimes conditions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux Xiaomi MariaDB Redmi