Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2003
    Posts
    341

    Question Problem to connect user to database (mysql, PLESK)

    Hello!

    I am used to Cpanel, but now I am trying to create a mysQL connection with PLESK to the database. Are there any differences between Cpanel and PLESK in this matter?

    I have added a user ( name: user23) to the db.

    I go like this:

    PHP Code:
    <?
    $dbh
    =mysql_connect ("localhost""user23""xxxx") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("bilde_emaillist"); 

    $Query "INSERT INTO emaillist(email) values('$email')" or die (mysql_error());
    mysql_db_query ("bilde_emaillist"$Query$dbh) or die (mysql_error());
    mysql_close($dbh); 
    ?>
    Error msg:
    Access denied for user: [email protected]' to database 'bilde_emaillist'

    I ahev also tried with: "bilde_user23" in the connection string

    Account user name is: bilde
    Database name is: emaillist

    Anyone has an idea please? or an example of a working PLESK, mySQL connection maybe....? (remember to take away the password)
    Last edited by developer; 04-23-2004 at 08:09 AM.

  2. #2
    Join Date
    Dec 2001
    Location
    Above The Clouds
    Posts
    6,999
    Yea, Plesk doesn't add the account name to the database. So in your query, just use "emaillist" and not "bilde_emaillist".
    Laurence Flynn @ atOmicVPS LTD
    Linux & Windows Cloud Hosting Solutions Powered by OnApp
    Fully Managed [Shared][Reseller][Cloud VPS] [Dedicated]
    Featuring the atOmicSTACK ● Speed ● Performance ● Reliability

  3. #3
    Join Date
    Mar 2003
    Posts
    341
    Thanks for the answer

    Still having problems

    Trying this:

    PHP Code:
    <?
    $dbh
    =mysql_connect ("localhost""user23""xxxxx") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("emaillist"); 

    $Query "INSERT INTO emaillist(email) values('$email')" or die (mysql_error());
    mysql_db_query ("emaillist"$Query$dbh) or die (mysql_error());
    mysql_close($dbh); 
    ?>
    Same error message( Access denied for user: [email protected]' to database 'emaillist'
    )

    ( password double checked)

  4. #4
    Join Date
    Dec 2001
    Location
    Above The Clouds
    Posts
    6,999
    Well, I'm no coder, just know Plesk. If there is something wrong with the actual query, maybe someone else will chime in.
    Laurence Flynn @ atOmicVPS LTD
    Linux & Windows Cloud Hosting Solutions Powered by OnApp
    Fully Managed [Shared][Reseller][Cloud VPS] [Dedicated]
    Featuring the atOmicSTACK ● Speed ● Performance ● Reliability

  5. #5
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    Could be that your user does not have proper permissions to the database emaillist.

    In cpanel, you have to assign a user to a database, don't know what it the equivalent in Plesk.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  6. #6
    Join Date
    Mar 2003
    Posts
    341
    Originally posted by fyrestrtr
    Could be that your user does not have proper permissions to the database emaillist.

    In cpanel, you have to assign a user to a database, don't know what it the equivalent in Plesk.
    Yes, that was the problem.

    Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •