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.

Home Page:http://spring.io/guides/gs/accessing-data-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL recomandation

Maokaitou opened this issue · comments

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'

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

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