spring-guides / gs-accessing-data-mysql

Accessing data with MySQL :: Learn how to set up and manage user accounts on MySQL and how to configure Spring Boot to connect to it at runtime.
http://spring.io/guides/gs/accessing-data-mysql/
Apache License 2.0
201 stars 314 forks source link

SQL recomandation #31

Closed Maokaitou closed 4 years ago

Maokaitou commented 4 years ago

create user 'springuser'@'%' identified by 'ThePassword'; I recomandation chang ‘%’ to'localhost'

because revoke all on db_example.* from 'springuser'@'localhost'; will throw Error. There is no such grant defined for user 'springuser' on host 'localhost'

dsyer commented 4 years ago

Maybe ‘%’ is better (it’s not common to run your database and application on the same host in production)?

Maokaitou commented 4 years ago

I agree with you. But you used '%' to create a user, but used 'localhost' when resetting permissions. I think it's better to unify.