Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon May 14, 2012 4:11 pm 
Offline
Senior Newbie

Joined: Tue May 01, 2012 3:31 pm
Posts: 5
All,

I need some help with a DB/PHP user access issue.

I setup PHP and MySQL as per the instructions here:

http://library.linode.com/databases/mys ... 0.04-lucid

I know both PHP and MySQL are working OK. In fact, I can write a PHP script that connects to the DB and inserts some data from the command line with a MySQL user I specified ('user'@localhost). All good.

The problem I am having is when I try to insert some data into a DB from PHP when the PHP script is run from a URL. I installed Apache and everything with the server is working ok. I get an 'Unable to select database' error message when I try to connect to the database with any MySQL account other than the root. I granted a user access to all privileges for the database in question, and it's still unable to connect.

Basically I don't want to have to use the root account for these DB scripts, but I can't get a user account I created to work.

To connect to the DB, I am using standard PHP code...

$user = 'theuser';
$database = 'databasename';
$password = 'thepassword';
$server = 'localhost';

$connection = mysql_connect($server,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

This must be something really simple, and I am not as well-versed with these kinds of issues as I would have liked. Thanks for any assistance.

-et


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group