Welcome, Guest
Please Login or Register.
Lost Password?
Specific GRANT statements for new mysql users. (1 viewing)
Post Reply

TOPIC: Specific GRANT statements for new mysql users.

#8761
TonyShadwick (User)
Posts: 140
graphgraph
Specific GRANT statements for new mysql users. 2007/11/30 03:21  
As you're aware, I use ndbcluster here. :)

I'm finally starting to finish up our database deployment, and there's just one last piece to the puzzle that needs cleared up...

We have multiple web servers, and multiple database servers. I have used mysql's built-in replication to replicate mysql.user to my non-virtualmin mysql servers. I add a user on my virtualmin box, it gets created on the other servers.

Whether I do it this way, or use Jamie's feature to create users on multiple servers, one issue remains...

Each user needs grant permissions for all of our web servers. By default, virtualmin only does so on it's host, and localhost.

I'd like to be able to say "when you create the mysql user, also grant on hosts x, y, and z". I can probably hack this in, but ideally I could grant specific permissions from multiple hosts at user creation time, and just run a script that hits all of the existing users.

For now I'll probably just put a cron job in that makes sure all of the users have grant from the web servers. Here's to hoping! :)
  The administrator has disabled public write access.
#8762
TonyShadwick (User)
Posts: 140
graphgraph
Re:Specific GRANT statements for new mysql users. 2007/11/30 03:26  
FYI, here's a good tutorial on getting the user table to replicate:

http://www.databasejournal.com/features/mysql/article.php/3355201

Here's the quick and dirty version. On the master:

GRANT REPLICATION SLAVE ON *.* TO slave_user IDENTIFIED BY 'slave_password';

In the master's my.cnf, under mysqld, add:
log-bin
server-id=1

On your slaves, in my.cnf under mysqld, add:
master-host=master-hostname
master-user=slave-user
master-password=slave-password
server-id=2
replicate-do-table=mysql.user
replicate-wild-ignore-table=*.*

Be sure to keep incrementing server-id. Restart mysql on all servers. Add a user or change a user permission on the master server, then on master and slave do:

select * from mysql.user;

The two should match. :)
  The administrator has disabled public write access.
Post Reply
get the latest posts directly to your desktop

Talk and Get Help

Support
Forums
Bugs and Issues

Get Virtualmin

OS Support
Buy Online
Download
Copyright 2005-2007 Virtualmin, Inc. All rights reserved.