Adding users to mysql
MySQL's permissions differentiate access to a database by a user not only on the user name, but also on the location from which the user is accessing the database. For example, user "foo" accessing the database from the same machine as the mysql server may not be the same "foo" using it from a remote client. For this, the "user" table in the default "mysql" database has an extra field for "host" to specify the users and their permitted locations.
One can use the GRANT command to add new user and his location to the permitted users as follows:
One can use the GRANT command to add new user and his location to the permitted users as follows:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;You can allow acces from a specific remote machine as follows:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'myremotemachinename' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;or to allow access from any remote machine, use the '%' wildcard:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home