2025-04-04 22:36:29 -04:00

18 lines
905 B
Plaintext

{
use esmith::util;
my $pw = esmith::util::LdapPassword();
$OUT .= "use mysql;\n";
$OUT .= "FLUSH PRIVILEGES;\n";
$OUT .= "CREATE OR REPLACE USER 'root'\@localhost IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD(\"$pw\"); \n";
$OUT .= "GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION; \n";
$OUT .= "FLUSH PRIVILEGES;\n";
# will not work as requires the With_grant privilege.... but accepts second line to alter the table to give it...
#$OUT .= "GRANT PROXY ON ``@`` TO `root`\@localhost WITH GRANT OPTION;\n";
$OUT .= "REPLACE INTO `proxies_priv` (`Host`, `User`, `Proxied_host`, `Proxied_user`, `With_grant`, `Grantor`, `Timestamp`) VALUES
('localhost', 'root', '', '', 1, '', current_timestamp()),
('$SystemName.$DomainName', 'root', '', '', 1, '', current_timestamp());\n";
$OUT .= "FLUSH PRIVILEGES;\n";
}