Re: semi-OT Grant Tables in MySQL

From: Date: Tue, 09 Jan 2001 10:04:28 +0000
Subject: Re: semi-OT Grant Tables in MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-5731@lists.php.net to get a copy of this message
Addressed to: John Starkey <jstarkey@advancecreations.com> php-db@lists.php.net ** Reply to note from John Starkey <jstarkey@advancecreations.com> Mon, 8 Jan 2001 22:51:33 -0700 (MST) > > Please forgive me but I really don't want to sign on to another list > for one question. And I am trying to access MySQL via PHP. > > So uhhh. How do I set up user tables in MySQL. > > Using > > "GRANT ALL PRIVILEGES ON db.* TO user@localhost IDENTIFIED BY > 'passwd'; > > Is returning SYNTAX OK 0 rows affected and access denieds. > > Can anyone tell me what's going on? I can access it without > specifying a user. And with PHP I get @localhost denieds. The GRANT command looks valid. What is the exact error message? You are doing this from the mysql command line interpreter, right? What user did you connect as? You probably need to be root to setup initial privileges, and you should be certain that the root database user has a password. NOTE: root for the database is not the same as root for the system. If you did not use -u username to select a user, mysql defaults to the system user you are logged in as. For most PHP access to a database I would use: GRANT INSERT,DELETE,UPDATE,SELECT ON database.* TO someuser@localhost IDENTIFIED BY 'password'. Unless you have a good reason to allow PHP programs to create, alter and drop tables, it is a bad idea. The least privileges rule applies here too. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.db (#5731) next »