WordPress Database error

CannonBallGuyCannonBallGuy ModeratorShared Hoster
For lack of anything else to do with cannonballguy.com, I decided to make it a blog and headed straight for WordPress which seems to be the standard these days...
My problem is that I changed the wp-config.php but I guess I got something wrong because cannonballguy.com says:
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at DB_HOST.

The hosting accounts main domain is kaziaz.com and cannonballguy.com is an addon domain. Is this why
define('localhost', 'localhost');
won't work?

What am I doing wrong? What should I put as the DB-host?

Comments

  • PythonPython Forum Leader The Royal RAM
    your host needs to be 'localhost' so that part seems to be right.

    Just make sure that your username and password are right for your database. Also check to see if that particular user has been added to the database in your cPanel.

    The Royal Ram

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    All double-checked... still won't work. :/
  • PythonPython Forum Leader The Royal RAM
    Ok...

    Just edit the following variables and upload to your server just to test if you are connecting using the right details. If not then its a problem with WordPress itself.

    [PHP]<?php

    $server = "localhost";
    $dbuser = "username";
    $dbpass = "password";
    $dbname = "databasename";

    echo "Attempting...<br><br>";
    mysql_connect($server, $dbuser, $dbpass) or die ("Could not connect");
    echo "Connected<br>";
    mysql_select_db($dbname) or die ("Could not select database");
    echo "Database Selected<br><br><br>";

    echo "Everything was fine";
    ?>[/PHP]

    The Royal Ram

  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Done... And it works....
    http://www.cannonballguy.com/testdb.php

    But WordPress still won't...
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    The README file said I only had to edit the one file...
    I did and it is now:
    <?php
    // ** MySQL settings ** //
    define('[b]matsim68_WP[/b]', 'wordpress');     // The name of the database
    define('[b]matsim68_WP[/b]', 'username');     // Your MySQL username
    define('[b]*****[/b]', 'password'); // ...and password
    define('[b]localhost[/b]', 'localhost');     // 99% chance you won't need to change this value
    
    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix  = 'wp_';   // example: 'wp_' or 'b2' or 'mylogin_'
    
    // Change this to localize WordPress.  A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');
    
    /* Stop editing */
    
    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>
    

    I only edited the bits that are now bold...
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    Ugh. I am a retard...
    The code said:
    efine('DB_NAME', 'wordpress');     // The name of the database
    define('DB_USER', 'username');     // Your MySQL username
    define('DB_PASSWORD', 'password'); // ...and password
    define('DB_HOST', 'localhost');     // 99% chance you won't need to change this value
    
    And I was changing the actual variable names, not the values that they equate too...
    You never would have guess I was learning PHP, eh?

    Anyway... it's fixed now. I guess this topic can be removed!
  • dabossdaboss WP V.I.P. ''The Boss'' Administrator
    cbg, happens all the time... happens all the time... good that it's up and running then... ;)
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    /me is stoooopid...
    But. yes it is working, and with a new theme... :)
    http://www.cannonballguy.com
  • dabossdaboss WP V.I.P. ''The Boss'' Administrator
    yeah, the new theme/template is a looker... :)

    you can check out lots of others at alexking.org....
  • CannonBallGuyCannonBallGuy Moderator Shared Hoster
    That's where i got this one... I quite like it... But I would love to make my own and I am looking at the source code now. :D
  • PythonPython Forum Leader The Royal RAM
    Lol. Glad you sorted it out.

    Good luck with the site :)

    The Royal Ram

Sign In or Register to comment.