# Security Question

**URL:** <https://forums.percona.com/t/security-question/21991>\
**Category:** Percona Server for MySQL 5.7\
**Created:** [May 10, 2023, 5:40pm UTC](https://forums.percona.com/t/security-question/21991 "2023-05-10T17:40:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultrapain](https://avatars.discourse-cdn.com/v4/letter/u/c77e96/32.png) [@ultrapain](https://forums.percona.com/u/ultrapain)\
**Post date:** [May 10, 2023, 5:40pm UTC](https://forums.percona.com/t/security-question/21991/1 "2023-05-10T17:40:03Z")

</div>

General security “issue” that has me puzzled regarding user accounts/DB access. Let’s say I have a DB called mydb on a home network (192.168.0.x subnet), and I execute the following statements:

grant usage on _._ to ‘testuser’@‘%’;  
grant all privileges on ‘mydb’ to ‘testuser’@‘%’;

grant usage on _._ to ‘testuser’@‘192.168.14.50’;  
grant all privileges on ‘mydb’ to ‘testuser’@‘192.168.14.50’;

Does one statement take precedent over the other? The first two statements grant remote access to all hosts, whereas the second two grant it to a specific remote host.

I ask this because I’ve inherited multiple DBs with this scenario and, in my mind, if we have the ‘user’@‘%’ grant in there, then it’s silly to have all the others in there, and they should be removed, but I want to confirm that I understand the entries correctly, if that makes sense.

Any guidance would be greatly appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [May 15, 2023, 11:00am UTC](https://forums.percona.com/t/security-question/21991/2 "2023-05-15T11:00:03Z")

</div>

Hi, my understanding is it works like this: if user from 192.168.14.50 connects, then since there is a specific entry for that IP, it will be used instead of the more generic %.  
Best to run a few tests to confirm though.
