wordpress error establishing a database connection [SOLVED]

Status
Not open for further replies.

Jaeden hyland

Reputable
Jan 21, 2016
25
0
4,540
hello guys im trying to figure out where i went wrong in my lubuntu 16.04 installation of wordpress. i don't know a whole lot of what to do but i ran into this error while trying to get on word press. says that the username or password in my wp-config.php file could be incorrect or they cant contact the database server at localhost. this could mean my database server is down

i used this guide to install word press https://www.techrepublic.com/article/how-to-install-wordpress-on-ubuntu-16-04/

i think i might know where i went wrong but im not to sure, when using this command. CREATE DATABASE wpdb;
​GRANT ALL PRIVILEGES ON wpdb.* TO 'USERNAME'@'localhost' IDENTIFIED BY 'ADMIN_PASSWORD';
​FLUSH PRIVILEGES;
​EXIT;

it said wpdb cant create because it already exists then gave me an error 1046 also saying my sql syntax doesn't work or something wont create my username and password. after putting that command in again and it keeps giving me this sign '> everytime i put in a command it didnt work so i shutted down the terminal and opened a new one and skipped that step since it didnt work. that might not be the problem but just putting it out there. could you guys please help me thanks in advance.
 
Solution
its all ok guys i got it working i just had to put in this command ​GRANT ALL PRIVILEGES ON wpdb.* TO 'USERNAME'@'localhost' IDENTIFIED BY 'ADMIN_PASSWORD';
​FLUSH PRIVILEGES;
​EXIT;
you dont need a to change data base name if it already has one and make sure you take out 'admin_password' and 'username' and replace it with your own, not to sure of way it started working when i finish the installation and putting that command in after but it worked, sorry if i couldn't help.

Jaeden hyland

Reputable
Jan 21, 2016
25
0
4,540
its all ok guys i got it working i just had to put in this command ​GRANT ALL PRIVILEGES ON wpdb.* TO 'USERNAME'@'localhost' IDENTIFIED BY 'ADMIN_PASSWORD';
​FLUSH PRIVILEGES;
​EXIT;
you dont need a to change data base name if it already has one and make sure you take out 'admin_password' and 'username' and replace it with your own, not to sure of way it started working when i finish the installation and putting that command in after but it worked, sorry if i couldn't help.
 
Solution
Nov 9, 2018
4
0
10
To fix a WordPress error, you’ll need to know what’s causing it. To know what’s causing it, you’ll need to enable WordPress logs.

You can use WordPress logs to fix many of the problems that occur on your WordPress site. This super helpful feature tracks errors and records them so you can get started on the troubleshooting process.

For a complete guide to this process, you can read here, but I’ll go over the basics on this post. WARNING: Before changing any files, make a backup of your site.

Access your website’s files. You’ll want to use an FTP to do this.
Open your wp-config.php file. Once you have this open in your FTP, you’ll want to open your root file (often named root or named after your site) and you’ll want to open the wp-config.php file. Scroll down until you see a line that reads “/* That’s all, stop editing! Happy blogging. */.” You’ll need to paste in the following line of code before this:

define( 'WP_DEBUG', true );

This coding instructs WordPress to activate the debug mode. If it’s already there, just change false to true.

Right underneath that line, you should add one more snippet:

define( 'WP_DEBUG_LOG', true );

After this you can save the newly edited file and exit. Then you will want to trigger your error message again so that it will record in the log.

3. Find your WordPress logs. In your site’s root folder, navigate to the wp-contentfolder, and look for a new file called debug.log:

After you see what caused the error, you may be able to troubleshoot it yourself. If not, you can go to the WordPress tech support forum and find answers there. If you don’t find answers, submit a post and be sure to copy and paste your error code there so you can get help quickly. I hope this helps!

*One more quick note, you’ll want to turn your logs off after fixing the issue because having it run continuously can slow down your site. You’ll follow the same instructions as above to access your wp-config file only this time you’ll change the “true” back to “false”.
 
Status
Not open for further replies.