# Granting access to a database to a remote client by IP - SQL
Data Science for Political and Social Phenomena
Author: Guillaume Redoulès

# Granting access to a database to a remote client by IP

The MariaDB users are granted access based on where the connection is coming from. By default the access is restricted to: * 127.0.0.1 * localhost

The program you are using to connect is not indentifying itself as 127.0.0.1 or localhost. You will have to verify the IP access it's being identified as, then add that to your grant table.

In order to add grant an IP address you can use the following commands :

    GRANT ALL ON *.* TO 'user'@'computer.host.com';
    GRANT ALL ON *.* TO 'user'@'192.168.1.6';
    GRANT ALL ON *.* TO 'user'@'%';

The `%` is a wildcard that means any IP. Be careful when using it especially on the root user.

If you want to remove the rights you granted, you can use the command

    REVOKE ALL PRIVILEGES ON *.* TO 'user'@'computer.host.com';
    REVOKE ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.6';
    REVOKE ALL PRIVILEGES ON *.* FROM 'user'@'%'

### Find an error or bug? Have a suggestion?

Everything on this site is avaliable on GitHub. Head on over and submit an issue. You can also message me directly by email.