Hi I am trying to install worpress on xampp to design and test my blog on but when I go to localhost/wordpress it keeps telling me that
"Error establishing a database connection"
Please help been trying everything.
// ** 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', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** 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', '');
I am running it on Windows XP
Try create Wordpress database on your MySQL server
The error message would suggest that the details you have in your code sample are incorrect.
Do you have a 'wordpress' table?
Can you log into phpMyAdmin using the XAMPP suite using the account 'root' without a password?
You may need to setup a new user account with a password and grant the relevant privileges and then re-install Wordpress.
Related
I am trying to install Wordpress in my localhost Xampp server
But every time I got an error message with
error establishing 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.
I have already googling but not get the correct answer yet.
I add define( 'WP_ALLOW_REPAIR', true ); in wp-config.php but not solved.......
This means wordpress can't find your database.
Navigate to http://localhost/phpmyadmin. Where it says create new database, choose a name for your database.
Next, open up wp-config.php in the root of your wordpress folder, and update the four values shown below to reflect your new database.
The default credentials for your newly created database are:
DB_NAME: Your chosen db name (case sensitive)
DB_USERNAME: root
DB_PASSWORD: ""
DB_HOST: localhost
/** The name of the database for WordPress */
define('DB_NAME', 'case sensitive chosen db name');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
I have solved my error as below procedure.
While installing Wordpress in localhost, first set some credentials of the file wp-config-sample.php as below
/** The name of the database for WordPress */
define( 'DB_NAME', 'learn_wordpress' );
/** MySQL database username */
define( 'DB_USER', 'root' );
/** MySQL database password */
define( 'DB_PASSWORD', '' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
and save the file name as wp-config.php and run again localhost/wordpress in the url.
It's done !!
I am working with a managed server from 1&1 and I am trying to manually install WordPress with no luck. I went and downloaded the WP core files, uploaded them via FTP and then went into mySQL and created the database and username/password etc. and assigned the privileges. When I try to install wordpress via "www.example.com/wp-admin/install.php", I continuously receive the error:
Error establishing a database connection
I tried everything and triple checked my user,password, etc.
Here is my credentials (Password is hidden):
// ** MySQL settings ** //
/** The name of the database for WordPress */
define('DB_NAME', 'yourdb');
/** MySQL database username */
define('DB_USER', 'yourdb user');
/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');
/** MySQL hostname */
define('DB_HOST', 'hostname');
Host name is always a localhost. for check your database credential is correct or not please feel a wrong value # let me know I am here
Try use 127.0.0.1 instead of localhost as the db host. Had the same issue and this fixed it for me.
I am struggling to finish the local installation of Wordpress on MAC. I used MAMP and migrated all the files successfully: database on PhpAdmin and wp-config.php & wp-content.php via FileZilla. I get a database connection issue when trying to access the site.
I followed the instructions of this guy:
https://hsnyc.co/how-to-transfer-a-live-wordpress-website-to-your-localhost-manually/
except that I use MAMP and the localhost is Macintosh> Applications>MAMP>htdocs (The Database is under htdocs)
Tools used on a MAC Book Pro:
MAMP
PhpAdmin
FileZilla
Interconnect It
Wordpress
The PHP version used is 7.0.0.
Note: the Database name Is made of capital and small letters no space.
I changed the Database credentials in wp.config.php to the below:
define('WP_HOME','http://localhost/DataBaseName');
define('WP_SITEURL','http://localhost/ DataBaseName ');
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'DataBaseName');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', 'localhost');
I also get a 404 error message when clicking on "localhost:3306" tab in PhpAdmin.
Solutions tried:
I reviewed the DataBase credentials
I tried changing the Localhost to "localhost:3306", " 127.0.0.1", " 127.0.0.1:3306".
Note: at first, I entered the wrong database name and got a message that the database couldn't be found.
I have created a copy of may wordpress site locally (importing the SQL) and going through one connection bug after the other for days and I'm really almost giving up.
I went through several Database connection errors and now I am on another for which I cannot find an answer in the forums.
I am running the website locally after downloading it and importing the dabase so I have:
define('DB_NAME', 'db_mysitename');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', 'local.mysitename');
/** 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', '');
/** debuging mode*/
define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
But when I navigate to local.mysistename/ I get the following:
Warning: mysql_connect(): Unknown MySQL server host 'http' (2) in /Users/me/Sites/mysitename/wp-includes/wp-db.php on line 1141
So I added a database test script in db-test.php
And illogically this works:
wp_commentmeta wp_comments wp_links wp_options wp_postmeta wp_posts wp_term_relationships wp_term_taxonomy wp_terms wp_usermeta wp_users
Why would it work for the test script but not for the website? Any ideas?
Please help.
just put all above information in wp-config.php file at root directory of your wordpress blog
and please change define('DB_HOST', 'local.mysitename') to define('DB_HOST', 'localhost')
it will work
local.mysitename looks like an alias you would have listed in your hosts file, which means an alias for a location that you access over http. You don't generally access databases over http connections, so that looks like it could be the problem. If the database is running on your computer, then you'll want to use localhost or whatever your machine's local IP is.
I am really confused by the wordpress installation. The wp_config file has the root username and password for my instance of mysql (localhost) and I have created a blank database called 'wordpress' (I am not sure whether I am supposed to have a database created to begin with).
When I go to http://localhost/wordpress/ I get an 'Error establishing a database connection' message. Am I suppose to have a database called 'wordpress' to begin with?
These are my credentials from the config file:
// ** 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', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'friday');
/** 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', '');
See http://techtrouts.com/mac-mysql-does-not-connect-on-localhost-but-connects-on-127001/
for some information on this.
Basically, on a default installation on a Mac you have to connect to 127.0.0.1 instead of localhost. So if you change the following it should work.
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');
With Wordpress you should have a database setup already (no tables, just the database).
So the first option should be the database name. If you're on shared hosting there might be a prefix before the database name.
Then the user of the database (which should be set up when setting up the database).
Then the password of that user.
Then, finally, the host is usually localhost, but if you're on shared hosting it could be different. You'd have to check your hosting providers docs to be sure.
Also, the first place you should go to is: http://localhost/wordpress/wp-admin/install.php