Re: msyql - scripting (94 Views)
Super Advisor
Posts: 339
Registered: ‎01-12-2007
Message 1 of 2 (94 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
Honored Contributor
Posts: 3,214
Registered: ‎08-26-1998
Message 2 of 2 (94 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...
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.