Re: msyql - scripting (72 Views)
Reply
Super Advisor
Piotr Kirklewski
Posts: 339
Registered: ‎01-12-2007
Message 1 of 2 (72 Views)

msyql - scripting

Hi there

I want to do this from a script:

mysql -u root
GRANT ALL ON *.* TO 'xxx'@'localhost'IDENTIFIED BY 'xxx';
quit;


If I just stick "mysql -u root" inside a script then it opens mysql and wait's for user interaction. I need to grant the permissions for a certain user and move to other commands.

Reagrds
Jesus is the King
Honored Contributor
Mel Burslan
Posts: 3,214
Registered: ‎08-26-1998
Message 2 of 2 (72 Views)

Re: msyql - scripting

The construct you are looking for is something like this :

...
other commands here
...

mysql -u root <GRANT ALL ON *.* TO 'xxx'@'localhost'IDENTIFIED BY 'xxx';
quit;
EOF

...
more commands here
...

hope this helps
________________________________
UNIX because I majored in cryptology...
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.