423 shaares
26 liens privés
26 liens privés
10 résultats
taggé
mysql
mysql -u<user> -p<password> -h<host> -e"select concat('show grants for ','\'',user,'\'@\'',host,'\'') from mysql.user" > user_list_with_header.txt
sed '1d' user_list_with_header.txt > ./user.txt
while read user; do mysql -u<user> -p<password> -h<host> -e"$user" > user_grant.txt; sed '1d' user_grant.txt >> user_privileges.txt; echo "flush privileges" >> user_privileges.txt; done < user.txt
awk '{print $0";"}' user_privileges.txt >user_privileges_final.sql
rm user.txt user_list_with_header.txt user_grant.txt user_privileges.txt
Un outil pour tester les performances sous Linux.
Il faut installer pipe viewer
On Ubuntu/Debian system
$ sudo apt-get install pv
On Redhat/CentOS
$ sudo yum install pv
Puis
$ pv sqlfile.sql | mysql -uxxx -pxxxx dbname
pipe viewer affiche la progression du dump.