[[mysql]]
 

MySql

Gentoo create inital db

emerge –config =dev-db/mysql-5.5.28

Add a user

GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Export Users an perms

mysql --batch --skip-column-names --execute="select concat('CREATE USER ''',user,'''@''',host,''' IDENTIFIED BY ''',Password,''';') from user where Password <> '''''';" mysql > mysql-users.sql

mysql --batch --skip-column-names --execute="SELECT DISTINCT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') AS query FROM user" mysql | mysql --batch --skip-column-names mysql | perl -p -e '$_ =~ s/$/;/; END { print "FLUSH PRIVILEGES;\n" }' > mysql-grants.sql


use mysql;
select concat('CREATE USER `',user,'`@`',host,'` IDENTIFIED BY `',Password,'`') from user;
mysql.txt · Last modified: 2014/05/13 00:09 by paulsmith
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki