msyql - scripting (55 Views)
Super Advisor
Piotr Kirklewski
Posts: 339
Registered: ‎01-12-2007
Message 1 of 2 (55 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';

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.

Jesus is the King
Please use plain text.
Honored Contributor
Mel Burslan
Posts: 3,213
Registered: ‎08-26-1998
Message 2 of 2 (55 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';

more commands here

hope this helps
UNIX because I majored in cryptology...
Please use plain text.
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