LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2019, 01:02 AM   #1
byebyemrgates
Member
 
Registered: Nov 2017
Location: Blue Mountains, Australia!
Distribution: Mint 19
Posts: 152

Rep: Reputation: Disabled
Question LAMP - “Error establishing a database connection” on local installation of wordpress


Hi there! Can someone help diagnose “Error establishing a database connection” on local installation of Wordpress on LAMP.
I followed this tutorial: https://www.digitalocean.com/communi...n-ubuntu-16-04
Checked database password and name in wp-config.php
If it is clue – this address 127.0.0.1:3306 gives this message in browser:
Code:
[���
5.7.27-0ubuntu0.18.04.1�3���BHL�˙÷�˙����������%:3{Y@jE�mysql_native_password���˙„Got packets out of order
I got 3306 from this:
Code:
~$ netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN     
tcp6       0      0 :::139                  :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 :::445                  :::*                    LISTEN
 
Old 08-22-2019, 03:14 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,793

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
Hi,

Can you connect to the database you created for wordpress from CLI:
Code:
mysql -u wordpress-user -pwordpress-password wordpress-database
 
2 members found this post helpful.
Old 08-22-2019, 03:56 AM   #3
byebyemrgates
Member
 
Registered: Nov 2017
Location: Blue Mountains, Australia!
Distribution: Mint 19
Posts: 152

Original Poster
Rep: Reputation: Disabled
Sorry, I found the solution myself after hours (luckily I had spare hours in sick leave...)
For others who may have this issue:
installed phpmyadmin but could not get access to it, so found this post:
https://askubuntu.com/questions/6687...on-this-server

used these commands it mentions:
Code:
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

sudo service apache2 restart
after that, could get wp-admin page, but it said that database does not exist.
created database again - and it worked...

Perhaps someone would like to explain what happened there?..
 
Old 08-22-2019, 04:38 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,793

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
Quote:
after that, could get wp-admin page, but it said that database does not exist.
created database again - and it worked...

Perhaps someone would like to explain what happened there?..
Perhaps you made a typo when you first created the database so WP could not connect to it. And maybe that's why you were able to created it again, I guess with the same name!
Now you've installed phpmyadmin, you can use it to see the existing databases and verify if that was the case.

Regards
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Error establishing a database connection LXer Syndicated Linux News 0 02-04-2018 10:21 AM
Fixing "Error Establishing Database Connection" Question frankbell Linux - General 3 04-30-2017 10:30 PM
Error establishing a database connection after installing kb2tfa Linux - Server 3 04-19-2015 03:16 AM
error establishing an encrypted connection to log in rfaruqui Linux - Newbie 6 04-18-2011 08:54 PM
Remote Desktop Connection hangs on 'Establishing connection...' madala Linux - Networking 1 06-27-2008 04:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration