Support » Installing WordPress » 2nd MySQL database – install error

  • Hi,

    I am new to WP but have managed to get a new site up and running using the 5 min install – great!
    However, I am now trying to create a second site on the same server (using easyPHP as with successful first install above)
    But on attempting to run install.php from new website I receive a database error:
    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 localhost. This could mean your host’s database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?

    The database exists, the username and password are correct – I do recall seeing something somewhere about prefixing databases if you want to run more than one WP site? Would that be the problem?
    Am I expecting things to be just too simple!?

    Any advice welcome….

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • designsimply



    First of all, that error does indicate that either the database name, username or password is incorrect… or, perhaps the database server is not running. Are you sure the MySQL server is on?

    Here’s a quick script from you can use to test your database connection.

    $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    if (!$link) {
        die('Not connected : ' . mysql_error());
    // make foo the current db
    $db_selected = mysql_select_db('foo', $link);
    if (!$db_selected) {
        die ('Can\'t use foo : ' . mysql_error());


    Now, if you are using the same database for the second installation, then you need to use a table prefix for the second WordPress install. If the first installation used a table prefix, then your second install table prefix needs to be different. Table prefix is set in wp-config.php.

    $table_prefix = 'wp_'; // Only numbers, letters, and underscores please!

    An alternative would be to create a separate database for the second WordPress installation, which is what I like to do because it’s more portable. Some shared hosting solutions only allow one database, so table prefixes are required if you want to have multiple WordPress installations on those types of accounts.

    Good luck. And, if you haven’t already, I would suggest making a full backup of your first site/database before continuing with the second.


    I am experience the same problem, but I can`t find a solution.
    There is one database on my domainname/server. And I want to install
    the blog on

    the database name is: cram_be
    the database user is: cram_be

    as you explained, I use the prefix wp_ ; please see the example:

    define("DB_NAME", "wp_cram_be");    // The name of the database
    define("DB_USER", "wp_cram_be");     // Your MySQL username

    But I keep on getting an error establishing database connection. Should I use the prefix in another way? What I am doing wrong?

    Any ideas, suggestions? Thank you very much,


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘2nd MySQL database – install error’ is closed to new replies.