HockeyKid57
Posts: 13
Joined: Thu Jun 27, 2013 5:24 pm

Error Establishing a Database Connection - Wordpress

Thu Jul 18, 2013 6:53 pm

Hello so I am trying to set up wordpress onto a server i have made and am running into a problem. I have installed, unzipped, and linked the file to the /var/www file and then i have used the Wordpress MySQL configuration script and everything is running good according to the Raspberry pi User guide. But then when i go onto http://localhost/wordpress/ to continue the installation process i get a bold message the says ERROR ESTABLISHING A DATABASE CONNECTION. So i dont really know what to do from here and any sort of help would be great.
Thanks!

MightyDjinn
Posts: 18
Joined: Tue Jun 25, 2013 3:57 pm

Re: Error Establishing a Database Connection - Wordpress

Thu Jul 18, 2013 7:19 pm

It's hard to answer given the amount of things it could be. Can you link to the "How To" you used? Also, can you link your "wp-config.php", and please remove any passwords before posting.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Error Establishing a Database Connection - Wordpress

Thu Jul 18, 2013 8:32 pm

It is a DB privilege issue, most likely.

I had a similar problem yesterday. I could not use @localhost as I had split the database to a separate Raspberry Pi

To configure MySQL

Code: Select all

mysql -u root -p
Use this single line to grant wordpress privileges

Code: Select all

GRANT ALL on wordpress.* TO [email protected] IDENTIFIED BY ‘password’;
This line is case sensitive!

So if your database name = wordpress1
and your username was = john
and your password was = 5656jack
It would look like this;

Code: Select all

GRANT ALL on wordpress1.* TO [email protected] IDENTIFIED BY ‘5656jack’;
The line above does exactly what is below just in a single line.

Code: Select all

CREATE DATABASE wordpress;
CREATE USER wordpressuser;
SET PASSWORD FOR wordpressuser= PASSWORD(“1234″);
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ’1234′;
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

HockeyKid57
Posts: 13
Joined: Thu Jun 27, 2013 5:24 pm

Re: Error Establishing a Database Connection - Wordpress

Fri Jul 19, 2013 8:37 pm

I feel really stupid asking this but, how do i figure out what my database name is. And is my username pi, because that is what i use to log into the raspberry pi and i have not yet been asked to make a username and password for Wordpress.

rodrigosuch
Posts: 5
Joined: Sat May 12, 2018 3:22 pm

Re: Error Establishing a Database Connection - Wordpress

Sat May 12, 2018 3:24 pm

Thank you!
It worked for me! It solved a 3 days issue!

jofori
Posts: 23
Joined: Sat May 19, 2018 1:29 pm
Location: London-Accra

Re: Error Establishing a Database Connection - Wordpress

Mon Jun 04, 2018 10:04 am

Hi

Answering HockeyKid57:
https://projects.raspberrypi.org/en/pro ... -wordpress

If you have set up Lamp-Wordpress correctly the user name for getting into the MYSQL database will be called "root" and password will be what ever you entered if you followed these instructions in the link above.

Computer User Name= pi , Password = Raspberry
or what ever you have changed it to.

MYSQL database
User Name = root Password = (blank = nothing)
or what ever you changed it to during MYSQL database installation.
If you did not provide a password it will be blank and when prompted for a password for the user root, just hit enter.

WordPress Site
What ever user you setup during Wordpress installation questionnaire page:i.e hockeykid57 for example
User Name = hockeykid57 and Password = (what ever password you entered during Wordpress installation)


Assuming you got all of that so far...
Go to Application Menu -> Accessories -> Terminal
At the command prompt type
i.e [email protected]:~ mysql -u root -p

(you will then be prompted for a password) if you haven't setup one just hit enter.
If you have, type it in - (Note: The password will not show anything while you type out the password, this a security measure by design) next hit enter

You will then be talking to your MYSQL database...in this case it's called MariaDB.
so it might look like this

MariaDB [(none)]>

to get out of it , just type "quit"
if you get stuck with a prompt that looks like ">"
type a semicolon " ; " no quotes and hit enter, then type "quit" no quotes and hit enter - and try logging in again
i.e mysql -u root -p

How to get the database name....
type "show databases;" (hit enter)
MariaDB [(none)]>show databases;
your databases will then be listed in a dotted box below.
MariaDB [(none)]>quit
and you see the message
BYE

You could then use other commands (before you entered "quit"to examine the databases, but I would highly recommend you read more on MYSQL commands before proceeding with any other instructions...

hope that helps
J

DirkS
Posts: 9957
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Error Establishing a Database Connection - Wordpress

Mon Jun 04, 2018 10:37 am

jofori wrote:
Mon Jun 04, 2018 10:04 am
Answering HockeyKid57:

[snip]

hope that helps
J
Unlikely... @HockeyKid57 last login on the forum was almost 5 years ago.

Return to “Networking and servers”