1747985 Members
5092 Online
108756 Solutions
New Discussion

msyql - scripting

 
Piotr Kirklewski
Super Advisor

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
1 REPLY 1
Mel Burslan
Honored Contributor

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...