Mysql – how to change “localhost” in MariaDB

centos-7mariadbMySQL

I wonder if there is any way to change localhost in MariaDB.

For example, while creating a user in database, it shows

'user'@'localhost'

I would like to know how to change localhost to any other hostname.

For example, I will be able to create a user in database like the following:

'user'@'mydomain.com'

By the way, I'm very new in MariaDB and SQL server stuff.

Thank you in advance!

Best Answer

The hostname component is the reference to the remote address of the connection. See create user.

Recommend keeping this constrained to a subnet.

Domain based grants while they look good, need reverse DNS setup to resolve this to an IP before allowing a connection. I recommend avoid them and using skip-name-resolve as a configuration option for extra speed and reliability.