Change account settings in db All sites on our server is currently getting spam users registering for new accounts.

Since none of the sites needs the option available for user to sign up, we would like to change the account setting "Who can register accounts?" being "Administrators only" for all sites.

The issue is we have around 800 sites, and i would rather not do this manually for all sites.

Is it possible to change this setting directly through the database?

Like one sql command that update alle databases and set the setting to being "Administrators only"?
You want to modify a user_register variable and set it to 0.
You can set it in code:

variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);


by drush:

drush vset user_register 0


or directly in database (note that in variable table are stored serialized values):

UPDATE variable SET value = 's:1:"0";' WHERE name = 'user_register';


but this requires cleaning cache.

DELETE FROM cache_bootstrap WHERE cid = 'variables';