WordPress Installation : Error establishing a database connection

Hello,

I’m trying to install WordPress on my new website.
I have created a MySql database :
a4800519_wp, a4800519_wpadmin, mysql2.000webhost.com
And phpMyAdmin can edit this database…

Here the wp-config.php content :


define('DB_NAME', 'a4800519_wp'); // The name of the database
define('DB_USER', 'a4800519_wpadmin'); // Your MySQL username
define('DB_PASSWORD', 'mypassword'); // ...and password
define('DB_HOST', 'mysql2.000webhost.com'); // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');

But… I have this problem :

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 mysql2.000webhost.com. This could mean your host's database server is down.

What is the problem ???

Thank you for your help

Are you sure you didn’t got anything wrong about the datas?

Have you configured the “database prefix” or something?

edit: oops I forgot if WordPress has that field “database prefix” XD

For the moment there is no tables and no data in my database !
Did I miss something ???

Yes I put this in the wp-config.php :


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

Thank you for your help !

sure about the password? Was the mysql user added to the database?

I changed it several time… But the problem is the same ;(

Here my database.
It is really empty !

here my database : http://imagik.fr/view-rl/175433

the IMG tag doesn’t work ???

yes, it´s empty. But my question was if the mysql user you created has been assigned to the mysql database in question. Afaik that needed to be done here in cPanel, might have changed but worth checking in the mysql overview

It seems to be good… From my newbie level :slight_smile:

I found :slight_smile:

I changed the permissions of my “/wordpress” directory to “777” !
And it worked :confused: !

I hope it will help somebody

yepp, looks fine. you sure there isn´t a typo in your password?

Hummmm There is maybe another thing :
Before when I edited the wp-config.php by hand the owner & group were “a4800519” (my user ID)
Now I used the wordpress configurator the wp-config is created and the owner & group are “99”

that shouldn´t make much of a difference. Would you mind supplying your FTP and MySQL details so i can have a look at your installation? You might also have a closer look at this tutorial which i did a while ago. Maybe you missed something.

You sure it’s all you’ve done and it worked?

Does it mean permissions also matters on Database?

Can you explain me again please how did you fix it? I have the same problem

It works.
Note for others: Check everything!!! EVERYTHING, THE WHOLE WP-CONFIG!!!

i know it works, hosting a WP blog on 000webhost.com for quite a while now

I see, but does permissions really matter about the connection to database?

actually I always have this “Error establishing a database connection” every now and then. I think it’s the mysql server refreshing that’s why you experience it.

Install WordPress is very easy compare with other script, the most important part is make sure all setting is correct.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘a2581234_WPblog’);

/** MySQL database username */
define(‘DB_USER’, ‘a2581234_abcd’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘wpbg1234’);

/** MySQL hostname */
define(‘DB_HOST’, ‘mysql4.000webhost.com’);

Enter your control panel to create data as same what is in wp-config.php setting.

If all setting correct run http://yourdomain.com/wp-admin/install.php follow the instruction and all done.

Upgrade to latest version is more easier, it take me 4 minutes and all done.

Load to your control panel run file manager, upload your latest file eg: wordpress-2.7.zip from file manager to your host after that extract wordpress-2.7.zip to your host, normally the files will be in wordpress folder. If your create your wordpress in root directory open your wordpress folder and mark all files inside and move to root directory if to other sub-directory move to your worpress sub-directory. After all done load your wp-admin, the script will ask your to update to latest version, click continue and wait for script process and all done.

Hope this will help to our new members in installing WordPress script.

alright look if you are using Wordpress, you must have this in your wp-config.php:

<?php

/** name  */
define('DB_NAME', 'aosidb');

/** nick name MySQL */
define('DB_USER', 'aosi87');

/** pass */
define('DB_PASSWORD', 'aosi');

/**  MySQL Host */
define('DB_HOST', 'xxxx.000webhost.com');

define('DB_CHARSET', 'utf8');

define('DB_COLLATE', '');

$table_prefix  = 'wp_';

define ('WPLANG', 'en_EU');


if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

require_once(ABSPATH . 'wp-settings.php');?>

if u have al this right…well erease the Database and create a new one with the same info (to dont modify wp-config.php)

if u still have problems try to conect to that DB in your browser…

or erease all folders except public_html and upload again only the wordpress folder(i mean wp-admin, wp-content, wp-includes, etc…)