How to give permissions to all Mysql users at once?

Asked

Viewed 86 times

2

I have a database that all Mysql users should be able to access. I’ve tried a GRANT ALL PRIVILEGES on nomedobanco.* to '%'@'%' identified by, but without success.

How can I do that?

1 answer

3


Mysql GRANT command does not accept wildcard for user definition.

A simpler option is to set to a specific host and without specifying a user:

GRANT ALL PRIVILEGES ON nomedobanco.* TO ''@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

In this case, any user authenticated by localhost will have the permissions given.

Another way is to define each of the users:

GRANT ALL PRIVILEGES ON nomedobanco.* TO 
 'usuario1'@'localhost',
 'usuario2'@'localhost',
 'usuario3'@'localhost';
  • Thanks for the answer! In case the "IDENTIFIED BY PASSWORD" I can keep the word PASSWORD? Each of the users has a different password.

  • 1

    Not because the identification is given by the password. In this case everyone would have equal passwords. A better option can be the second way.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.