MySQL Tutorial/Privilege/Remote User

Материал из SQL эксперт
Перейти к: навигация, поиск

Designate an IP or host address from which the user can connect

   <source lang="sql">

GRANT ALL PRIVILEGES ON myDatabase.* TO newuser@192.168.0.2 IDENTIFIED BY "newpassword";</source>


Give a non-local user permissions on the database for use with remote clients.

   <source lang="sql">

GRANT ALL PRIVILEGES ON myDatabase.* TO newuser@192.168.0.2 IDENTIFIED BY "newpassword"; Now a user on the machine "192.168.0.2" can connect to the database.</source>


To allow a user to connect from anywhere you would use a wildcard "%"

   <source lang="sql">

GRANT ALL PRIVILEGES ON myDatabase.* TO newuser@"%" IDENTIFIED BY "newpassword";</source>