MySQL, Adding Users
From FreeBSDwiki
(Difference between revisions)
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
To add new users to mysql use the following commands (if you haven't set a password for the mysql root user, leave off the '''-p'''): | To add new users to mysql use the following commands (if you haven't set a password for the mysql root user, leave off the '''-p'''): | ||
− | oyabun# '''mysql - | + | oyabun# '''mysql -u root mysql -p''' |
password: | password: | ||
> GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY 'pass' WITH GRANT OPTION; | > GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY 'pass' WITH GRANT OPTION; | ||
− | + | Note: that command grants full privileges on ALL databases to "user@localhost", effectively creating a new mysql root user, which is usually not what you want. More frequently, you will want to '''GRANT ALL PRIVILEGES ON <nowiki>[[databasename]]</nowiki>.*''' or something similar. | |
==External Links== | ==External Links== | ||
− | + | http://dev.mysql.com/doc/mysql/en/adding-users.html | |
− | + | ||
+ | http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/Adding_users.html | ||
[[Category:Common Tasks]] | [[Category:Common Tasks]] |
Latest revision as of 23:30, 15 August 2005
To add new users to mysql use the following commands (if you haven't set a password for the mysql root user, leave off the -p):
oyabun# mysql -u root mysql -p password: > GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY 'pass' WITH GRANT OPTION;
Note: that command grants full privileges on ALL databases to "user@localhost", effectively creating a new mysql root user, which is usually not what you want. More frequently, you will want to GRANT ALL PRIVILEGES ON [[databasename]].* or something similar.
[edit] External Links
http://dev.mysql.com/doc/mysql/en/adding-users.html
http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/Adding_users.html