Masiar
Masiar

Reputation: 21352

Setting up WordPress Locally

This may sound stupid, but it's frustrating me to death. I'm running OSX 10.6 and I did every step to install PHP and MySQL. I have the MySQL running, I created via terminal a database, called DBname. Now as WordPress says, I have to open wp-config.php and modify the information to make it able to connect to the database. At this point I'm not sure which username / password / host I'm using. As username I guess it's 'root', since I use the command ./mysql -u root to open up the MySQL client in terminal, no password, so I leave it '' and as host I guess it's 'localhost'. The problem is that when I connect to http://127.0.0.1/my-folder/wp/wp-admin/install.php the wordpress page is telling me the connection to the database failed.

I've been searching for at least one hour but couldn't find anything useful. Can someone point out what am I doing wrong? Thanks.

EDIT: I installed MAMP, it gave me as host localhost, as user root and as pass root. I could navigate to PHPMyAdmin and create a database called DBname, but when I input the info in the wp-config.php file still didn't work (same problem).

RE-EDIT: this is the wp-config.php file, sorry but it's the italian version lol.

<?php
/**
 * Il file base di configurazione di WordPress.
 *
 * Questo file definisce le seguenti configurazioni: impostazioni MySQL,
 * Prefisso Tabella, Chiavi Segrete, Lingua di WordPress e ABSPATH.
 * E' possibile trovare ultetriori informazioni visitando la pagina: del
 * Codex {@link http://codex.wordpress.org/Editing_wp-config.php
 * Editing wp-config.php}. E' possibile ottenere le impostazioni per
 * MySQL dal proprio fornitore di hosting.
 *
 * Questo file viene utilizzato, durante l'installazione, dallo script
 * di creazione di wp-config.php. Non è necessario utilizzarlo solo via
 * web,è anche possibile copiare questo file in "wp-config.php" e
 * rimepire i valori corretti.
 *
 * @package WordPress
 */

// ** Impostazioni MySQL - E? possibile ottenere questoe informazioni
// ** dal proprio fornitore di hosting ** //
/** Il nome del database di WordPress */
define('DB_NAME', 'DBname');

/** Nome utente del database MySQL */
define('DB_USER', 'root');

/** Password del database MySQL */
define('DB_PASSWORD', 'root');

/** Hostname MySQL  */
define('DB_HOST', 'localhost');

/** Charset del Database da utilizare nella creazione delle tabelle. */
define('DB_CHARSET', 'utf8');

/** Il tipo di Collazione del Database. Da non modificare se non si ha
idea di cosa sia. */
define('DB_COLLATE', '');

/**#@+
 * Chiavi Univoche di Autenticazione e di Salatura.
 *
 * Modificarle con frasi univoche differenti!
 * E' possibile generare tali chiavi utilizzando {@link https://api.wordpress.org/secret-key/1.1/salt/ servizio di chiavi-segrete di WordPress.org}
 * E' possibile cambiare queste chiavi in qualsiasi momento, per invalidare tuttii cookie esistenti. Ciò forzerà tutti gli utenti ad effettuare nuovamente il login.
 *
 * @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');

/**#@-*/

/**
 * Prefisso Tabella del Database WordPress .
 *
 * E' possibile avere installazioni multiple su di un unico database if you give each a unique
 * fornendo a ciascuna installazione un prefisso univoco.
 * Solo numeri, lettere e sottolineatura!
 */
$table_prefix  = 'wp_';

/**
 * Lingua di Localizzazione di WordPress, di base Inglese.
 *
 * Modificare questa voce per localizzare WordPress. Occorre che nella cartella
 * wp-content/languages sia installato un file MO corrispondente alla lingua
 * selezionata. Ad esempio, installare de_DE.mo in to wp-content/languages ed
 * impostare WPLANG a 'de_DE' per abilitare il supporto alla lingua tedesca.
 *
 * Tale valore è già impostato per la lingua italiana
 */
define('WPLANG', 'it_IT');

/**
 * Per gli sviluppatori: modalità di debug di WordPress.
 *
 * Modificare questa voce a TRUE per abilitare la visualizzazione degli avvisi
 * durante lo sviluppo.
 * E' fortemente raccomandato agli svilupaptori di temi e plugin di utilizare
 * WP_DEBUG all'interno dei loro ambienti di sviluppo.
 */
define('WP_DEBUG', false);

/* Finito, interrompere le modifiche! Buon blogging. */

/** Path assoluto alla directory di WordPress. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Imposta lle variabili di WordPress ed include i file. */
require_once(ABSPATH . 'wp-settings.php');

Upvotes: 0

Views: 391

Answers (1)

symcbean
symcbean

Reputation: 48357

When mysqld and mysql see localhost, they substitute the filesystem socket for the network socket. Using 127.0.0.1 connects to the network port - but similarly the permissions need to relect this if you're going to use the network connection (i.e. an entry for 'localhost' will not be used for validating network socket connections). Converseley, if you want to use the filesystem socket, then both ends need to be using the same path to the socket, and the connection is validated against 'localhost'.

since I user the command ./mysql -u root to open up the MySQL client in terminal, no password

OK, so in the absence of a -h it's using the filesystem socket - show variables like '%socket%' Make sure your php.ini has the same path set.

I installed MAMP, it gave me as host localhost, as user root and as pass root

But your password is blank.

Upvotes: 1

Related Questions