Need to add add'l db users. How?

Asked by erin oneill on 2009-09-24

I've got my QA group totally hooked on mysql_sandbox, but now they want to add a user to connect so they can start testing in their app. Of course I set it all up & then they changed the username/password on me. Do I really have to blow it all away & start again?

I know you didn't have a fab QA testbed in mind when you created mysql_sandbox but it's totally BRILLIANT for that. I just need to add diff sorts of db username/db pwd to ALL the sandboxes at once. sbtool doesn't seem to do this? (really I ran a sbtool --help AND RTFM). My users never wanna change ports, they want to change usernames!

ps. I got all 4 instances to use the default install of mysql but had to do a low_level_make_sandbox & watch that my ports didn't step all over each other.

Question information

English Edit question
MySQL Sandbox Edit question
No assignee Edit question
Solved by:
Giuseppe Maxia
Last query:
Last reply:

Thanks for your kind words.

To add new users, you need to connect to the sandbox as (mysql) root user.
Simply do the following:
./use -u root
mysql> GRANT whatever on database.* TO username IDENTIFIED by 'my_clever_password';

erin oneill (eonarts) said : #2

YEA! Your answer worked like a charm.

I created a sql file with the grant command & flush privileges (my nemesis is that darn flush!) & tried to run it on ALL my sandboxes (all 4) with
./use_all 'source /full/path/my.sql'

After this answer I went back & tried to run this:
./use_all -u root 'source /full/path/my.sql'
But alas it didn't work.

Thanks for the quick response.

use_all by default uses the 'msandbox' account. You can modify the parameters passed to each './use' script by setting the $MYCLIENT_OPTIONS environment variable.
For example, in your case, you could use

MYCLIENT_OPTIONS='-u root' ./use_all 'source /full/path/my.sql'