NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

michelefaccini's avatar
Oct 01, 2011

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');

16 Replies

Replies have been turned off for this discussion
  • G O T I T...From phpMyadm I edited wordpress SQL user's from localhost to % (which stands for any host)......
  • Hi Michelefaccini

    It seems that I have semilars problems....
    so please explain the last words(the GOT IT sentence):
    - form phpMyadm ..is this in the php-config, or wich PHP / info file
    - did you replace the 'localhost' in %
    Maybe a picture of the file can tell a thousand words...

    Thanks
    polderviolin
  • Hi,

    Anwer:
    Directly after installation (and configure phpmy.. hostname nas-ip,socketadress, uid/pw mysql) I could login in PHPADMIN (and create a db) after that login by PHPMYADMIN fails: Error 1045.
    So the problem:
    - login by phpmyadmin (start in windows/frontview) comes with error 1045
    - login db readynasphotos by MySQL ADMINISTRATION comes with error 1045

    Further info for now:
    ! I'm able to access mysql by putty in SSH (and also there create a db)
    ! with "MYSQL Aministration" and "SQL Lite Manager" (both alternative for PHPMYADMIM) I can access the Wordpress database but not the other databases gives also error 1045
    ! I have already reinstalled php5 (5.3.8) + PHPMYADMIN (3.4.5)...change mysql pw to be sure that phpmyadmin use the same...

    So I tried for a month to get phpadmin up & running (for wordpress) and I really need a helping hand/brain......
  • You wrote 'So the problem:
    - login by phpmyadmin (start in windows/frontview) comes with error 1045...'

    What do you mean by 'start in windows/frontview' ? You have to access you phpMyadmin from your web browser http://your NAS ip address/phpadm/.
    From there you should set up permissions over the databases.
  • Otherwise you could grant permissions over databases accessing the nas with the putty shell....

    Here's my 'config.inc.php' :
    /* 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'] = 'put here your password';

    /* End of servers configuration */

    $cfg['DefaultLang'] = 'en-utf-8';
    $cfg['ServerDefault'] = 1;
    $cfg['UploadDir'] = '';
    $cfg['SaveDir'] = '';

    Here's my '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
    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

NETGEAR Academy

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

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More