NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
michelefaccini
Oct 01, 2011Aspirant
Error establishing a database connection
Hi,I get this error when I try to execute Wordpress install.php to complete the installation.
Possible causes :
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?
I do have access to my database server because I can from phpMyadm do what I want....
Any idea ?
Here's my wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', 'mypassword');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
Possible causes :
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?
I do have access to my database server because I can from phpMyadm do what I want....
Any idea ?
Here's my wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', 'mypassword');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
16 Replies
Replies have been turned off for this discussion
- michelefacciniAspirantI didn't point out that I have PHP5_5.3.8-rnx86 1.4.1 already installed before I started installing Wordpress so in the How to's procedure I skipped the relative steps of installing PHP......Thanks for any answer...bye
- michelefacciniAspirantThere's also the fact that in the How-To's procedure there is no password to access mysql prompt (see steps where you have to create the DATABASE wordpress),mine is password protected....the trick should be around there.....
- sphardy1ApprenticeHave you followed these instructions: http://codex.wordpress.org/Installing_WordPress ??
If so, use phpmyadmin to login as the user you have defined to access the wordpress database - verify that you can in fact access it as that user and that the password is correct - michelefacciniAspirantI'm still there sorry...I checked that : PHP is running, the server is running, wordpress database has been created and I have access to it both from phpMyadmin and from the putty shell !
It's written (http://codex.wordpress.org/Installing_WordPress#Using_phpMyAdmin) :
in Step 3: Set up wp-config.php
You can either create and edit the wp-config.php file yourself, or you can skip this step and let WordPress try to do this itself when you run the installation script (step 5) (you'll still need to tell WordPress your database information).
That's why I only specified :
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', 'mypassword');
/** MySQL hostname */
define('DB_HOST', 'localhost');
and didn't modify manually all hoping that install.php would have help me for the rest...... - sphardy1ApprenticeDoes Wordpress have write access to the config file? Perhaps avoid the issue by manually updating it?
- michelefacciniAspirantThings seems to come to live when from the setup-config.php page (launched from my browser),I substitute DB User (which should be wordpress) with my name and substitute localhost with 192.168.0.2 (which is my NAS IP).I have the following message :
All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to…
And unfortunately just after I press on the 'Run the install' button :
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 192.168.0.2. 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?
If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums. - michelefacciniAspirantAn orrible doubt...do I have to create a user called 'wordpress' from the Frontview ?
- sphardy1Apprentice
michelefaccini wrote: An orrible doubt...do I have to create a user called 'wordpress' from the Frontview ?
No - but the mysql user you specify has to be setup in mysql with appropriate rights to the database you created - michelefacciniAspirantThat's what I did and the database 'wordpress' is accessible either from the putty shell either from phpMyadmin...I'm really trying to figure out what's wrong.I had sharing problems last week thinking it was due to my poor experience and then discovered that the cause was the last Radiator firmware (unfortunately after I already did a complete installation from zero....anyway...).To understand what's going on, things must be checked again one by one....I posted a topic under addon's which nobody answers to : from the page SQL of phpMyadmin,I would like to know how the server can be stopped and restarted...I mean the correct synthax command (I tried severals but always get an error).Finally I did a basic configuration of MySQL....may be there are some parameters which have to be setup....below is my.cnf file.....
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = admin is it right.....do I have to insert other users ?
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
skip-name-resolve
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
# skip-networking
innodb_buffer_pool_size = 6M
key_buffer_size = 16k
myisam_sort_buffer_size = 16k
max_connection = 20
#
# * Fine Tuning
#
key_buffer = 16k
max_allowed_packet = 16M
thread_stack = 128K
#
# * Query Cache Configuration
#
query_cache_limit = 1048576
query_cache_size = 32768
query_cache_type = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql.log
#log = /var/log/mysql/mysql.log
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
#log-bin = /var/log/mysql/mysql-bin.log
# See /etc/mysql/debian-log-rotate.conf for the number of files kept.
max_binlog_size = 16384
#binlog-do-db = include_database_name
#binlog-ignore-db = include_database_name
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
[mysqldump]quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M - michelefacciniAspirantUnderneath is my cnf.inc.php in which the authentication method is config....should this maybe set to cookie (if yes how...because I tried and never successed)
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'mypassword';
/* End of servers configuration */
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!