SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Thread: Database Error

  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database Error

    I'm sure the answer to my question is realy simple, but please don't flame me, I'm not very familiar with linux or MySQL.

    When I go to setup a php program, (php Website, a Nuke clone) I get the following message: "Please make sure your config.php file is correctly filled out before you continue to Step Two! Unable to select database!" I've went to the config file, and if I use any other values for the database variables, I can't even load the setup program. So I'm pretty sure I have the database set up properly, but I think for some reason there is a problem with the permissions somehow. I'm using php 4.0.6 and mySQL 3.29 I believe.

    I'm on a dedicated server and my SQL username and database were setup using cPanel, my account configuration tool.

    Thanks,
    Cameron

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you usually have to set up the database (create it anyways) before you run the installation program.

    In cpanel (default setup, many hosts change this around) click on advanced>mysql and then create a new database.

    In the config file you'll need to enter the name of this new database (its usually created in the format username_dbname by cpanel) and that should work.,
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aspen

    All of that has already been done. The db is created and named arspolit_phpws. I also have the usernames and passwords. So the congif file should have all the correct info, and I believe it does because any other combination of variables (username, password, host, database) won't let me access the setup program to get the error I'm getting. So I believe the config file is set up correctly, what could the unable to select databse error be?

    -Cameron

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post the contents of the config file so we can see if theres any anomolies.
    just sensor out any usernames/passwords etc.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ###################
    # Database Config #
    ###################

    $dbhost = "localhost"; # Mysql Database host
    $dbuname = "arspolit_censored"; # Mysql user
    $dbpass = "censored"; # Mysql password
    $dbname = "arspolit_phpws"; # Mysql Database name

    $database_connect = 1; # Set to 0 for a non-persistent database connection. May be faster for smaller servers.
    # Set to 1 for a persistent database connection. May be faster for larger servers.

  6. #6
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks good to me.
    you double check those thought to make sure?
    i've found that i get this whole big error because i mispelled a name or whatnot.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  7. #7
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have double even triple checked them. Like I said a couple posts ago, changing just one of the values doesn't let me bring up the setup script. So the values should be right, but the problem I think lies in the mySQL permissions. How can I check and make sure that the user I created has maximum permissions?

  8. #8
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, first, is this a server that your working on? IE - you have in your house, or a remote dedicated server?

    also, if you want to check if they have maximum permissions, have that person log into telnet with the user/pw. if they can access the database, then the user/pass works.

    do you think you may have named the database wrong?

    also, if you don't want him to/doesn't have telnet access, install phpMyAdmin on the server and see if he can change stuff. like add/delete databases:tables:records etc.

    with it unable to find the database it's likely that therse a problem with either the hostname or database name.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  9. #9
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's my own remote dedicated server, running RedHat 7.1.

    I think I'm gonna delete the database and then recreate it through telnet rather than cPanel. How do I create it from the command prompt? Should I log in as root, or as the sql username I created?

    Thanks for all the help,
    Cameron

  10. #10
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you shouldn't login as root unless your the only person using the server.

    the command to create a database is as follows:
    PHP Code:
    mysql_create_db("databasename""$db_connect"); 
    where
    PHP Code:
    $db_connect mysql_connect("host""username""password"); 
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops, misunderstood your question.
    what i posted above is how to create a new db using a php script.
    i'm not sure how to create a new db within the command prompt, never had to or able to.
    though i don't know how to create a table, you can connect to mysql like this:
    Code:
    mysql -u username -p database_name
    Last edited by Defender1; Jul 29, 2001 at 22:33.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  12. #12
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Defender thanks again for all your help, I really appreciate it.

    The problem is all fixed. When I created the user in cPanel, I created a user named "name", and it told me the user was arspolit_name. I just went into webhost manager and found out the only account was arspolit, the username created in Cpanel didn't exist but an account for the domain was created. Weird, but changing the user name variable fixed everything and the script installed without a hitch.

    -Cameron

  13. #13
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ArsPolitica, edit your config listing message. Remove the login and password from the message. Its not wise to post your passwords on a open public message board.

    Just some friendly advice.
    Kunal
    i dunno...

  14. #14
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the friendly advice kunal, but they already are censored. I left off the real endings.

    Cameron

  15. #15
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops
    i dunno...


Bookmarks

Posting Permissions

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