Following Google App Engine's instructions for creating a local WordPress development platform, I created the database and initial user using the instruction's MySQL direction:
I have created a user on SQL, created instances, allowed access but I keep getting the error
Error establishing a database connection
Below is my wp-config.php file:
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false) {
/** The name of the Cloud SQL database for WordPress */
define('DB_NAME', 'wordpresstest');
/** Live environment Cloud SQL login and SITE_URL info */
/** Note that from App Engine, the password is not required, so leave it blank here */
define('DB_HOST', ':/cloudsql/wordpresstest-1382:wordpresstest');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
} else {
/** The name of the local database for WordPress */
define('DB_NAME', 'wordpresstest');
/** Local environment MySQL login info */
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
}
Below is my app.yaml file:
# [START env]
env_variables:
# Replace project, instance, database, user and password with the values obtained
# when configuring your Cloud SQL instance.
MYSQL_DSN: mysql:unix_socket=/cloudsql/wordpresstest-1382:wordpresstest;dbname=wordpresstest
MYSQL_USER: root
MYSQL_PASSWORD: ''
# [END env]
When I run localhost on Google Cloud Launcher, still getting the error.
Related
While trying install wordpress i recieve following error
I use wampserver i have changed wp-config.php file and now it looks like this:
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', 'localhost');//i used 127.0.0.1 too but no matter
define('WP_DEBUG', true);
wp-db.php file:
1379 line:
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
1409 line:
$this->dbh = mysqli_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
but still no result I do not know what to do can anyone help me?
if you are using default configuration of xampp/wamp try with
define('DB_PASSWORD', ''); // for localhost
generally localhost db config:-
host = localhost
user = root
password = '' (blank)
Is root really the MySQL user you want to connect as? Is root its password?
It's usually not necessary and from a security standpoint potentially very dangerous to let web applications use your MySQL root user. Create a new user for your WordPress instance, give it its own database:
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO blog#localhost IDENTIFIED BY '3AmAbsKCsrKDw':
Then use that user
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'blog');
/** MySQL database password */
define('DB_PASSWORD', '3AmAbsKCsrKDw');
/** MySQL hostname */
define('DB_HOST', 'localhost');
define('WP_DEBUG', true);
That should let you connect. Verify that you can connect with those login credentials before continuing to your WordPress setup. WAMP includes a phpMyAdmin interface as far as I know, so try those credentials there.
Update your wp-config.php file like this
define your database name when you create on your localhost or server
define('DB_NAME', 'Your database name');
Ex:- You create your database name like "wordpress" then put database name like
define('DB_NAME', 'wordpress');
If you run your project in local always put root and when you upload database in your server you put your database user name when you create database
define('DB_USER', 'root');
Put your password when you create database on server other wise you can put ''
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('WP_DEBUG', true);
I properly set up the Cloud SQL instance and wordpress runs properly locally.
When I try to run the following commands, where INSTANCE_IP is my IP address to my Cloud SQL instance I get an error in my syntax:
{PATH_TO_MYSQL_BIN}/mysql --host=INSTANCE_IP --user=root --password
create database wordpress_db;
exit;
Edit, Error Message:
{PATH_TO_MYSQL_BIN}/mysql --host=xxx.19x.2xx.xx --user=root --password -> create database wordpress_db; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{PATH_TO_MYSQL_BIN}/mysql --host=173.194.243.33 --user=root --password create da' at line 1
If anyone could tell me what is wrong with my syntax that would be great, thanks in advance.
The following is the wp-config.php I believe is relevant:
// Required for batcache use
define('WP_CACHE', true);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_db');
/** MySQL database username */
define('DB_USER', 'root');
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
/** Live environment Cloud SQL login and SITE_URL info */
define('DB_HOST', ':/cloudsql/your-project-id:wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
} else {
/** Local environment MySQL login info */
define('DB_HOST', '127.0.0.1');
define('DB_USER', 'root');
define('DB_PASSWORD', 'password');
}
// Determine HTTP or HTTPS, then set WP_SITEURL and WP_HOME
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443)
{
$protocol_to_use = 'https://';
} else {
$protocol_to_use = 'http://';
}
define( 'WP_SITEURL', $protocol_to_use . $_SERVER['HTTP_HOST']);
define( 'WP_HOME', $protocol_to_use . $_SERVER['HTTP_HOST']);
/** 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', '');
looks like you're following a guide from the Google cloud project site.
Here's some solutions:
First, if you have altered the user name or password during mysql install, make sure you update that in the config.php for wordpress.
Here's the thing - in MySQL, if you are using the Workbench then all you need to run is:
create database wordpress_db;
As the other script was if you're running it from cmd tool I believe.
Google app-engine for wordpress is not running with the latest version in the local environment . I have configured every thing as per their tutorial at gae_help_page
They say it works for only Wordpress-3.5.1 and I have tested it with 3.5.1 it was running but when I use Wordpress-3.8.2 , keeping other thing same , it shows:
Error Establishing Database Connection
Thank in advance, I want to use the latest version of Wordpress.
This is known to work fine with the current version of WP (3.9), at least on OS X.
I suspect you have a mysql-related configuration issue. First, make sure that your mysql server is running on your local machine and that you have created the db that you want to use for the local installation.
Then, your wp-config.php should include something like this (edited appropriately for your setup)-- check that the local config values are correct:
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
/** Live environment Cloud SQL login and SITE_URL info */
define('DB_HOST', ':/cloudsql/your-project-id:wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'your-wordpress_db');
} else {
/** Local environment MySQL login info */
define('DB_HOST', '127.0.0.1');
define('DB_USER', 'your-local-user');
define('DB_PASSWORD', 'your-local-password');
define('DB_NAME', 'your-local-wordpress_db');
}
This worked for me:
/** Local environment MySQL login info **/
define('DB_HOST', '127.0.0.1:8889');
//define('DB_HOST', '127.0.0.1');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('DB_NAME', 'wordpress');
I'm using MAMP, if your are using a different installation probably the DB port changes.
I Hope it helps!
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.
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