
January 13th, 2013, 03:56 AM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
Create a user with the privileges your PHP script needs. That's probably SELECT, INSERT, and UPDATE, and possibly DELETE too. It should be as limited as you can get away with. The hostname for the user would just be "localhost", so you might issue
Code:
CREATE USER 'phpuser'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, UPDATE ON *.* TO 'phpuser'@'localhost';
Then use that account in your PHP code. Make it connect to "localhost". If that doesn't work then mysqld isn't set up to use whatsit sockets - those are the best things you can use but only available when MySQL and whatever software tries to use it (like PHP) are on the same machine.
|