How to give permissions for all MySQL users at the same time?

2

I have a database that all MySQL users should be able to access. I've already tried GRANT ALL PRIVILEGES on nomedobanco.* to '%'@'%' identified by , but to no avail.

How can I do this?

    
asked by anonymous 10.02.2017 / 18:27

1 answer

3

The MySQL GRANT command does not accept wildcard for user definition.

A simpler option is to define for 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 granted.

Another way is to define each of the users:

GRANT ALL PRIVILEGES ON nomedobanco.* TO 
 'usuario1'@'localhost',
 'usuario2'@'localhost',
 'usuario3'@'localhost';
    
10.02.2017 / 18:35