WordPress still cannot Establishing a Database Connection – Error

Do you ever experiencing this problem like this, after your install wordpress, setup anything, webserver, database, everything is completed. But wordpress still cannot establishing your database connection eventhough you already make sure that your database is up and running (I’m using MySQL) and your port is already open. Trust me, I’ve done anything properly, I spent hours just to figure out what the root cause was and after some googling and stackoverflowing, I found this problem was due to SE in linux.

$ sudo setsebool -P httpd_can_network_connect_db=1

Fix google gms services version conflict

So, this error showed up when I tried to update gms google services for push notifications.

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

Currently, I compiled android.gms:play-services with version 8.3.0 which is not allowed at this time cause I have different version level within my build.gradle file. To fix this, you just need to update com.google.gms:google-services version inside both build.gradle files.

build.gradle file in project level :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

inside the build.grade app level file, I added compile ‘com.google.android.gms:play-services:9.0.0’ inside dependencies tag and apply plugin: ‘com.google.gms.google-services’ at the end of lines. So, it looks like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.myLambdaapp.myLambdaapp"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:9.0.0'
}
apply plugin: 'com.google.gms.google-services'

Django table is marked as crashed and should be repaired

My django app is showing 500 because one of the tables in database marked crashed and should be repaired.

InternalError at /

(145, "Table './dbname/django_session' is marked as crashed and should be repaired")

I thought it was just an usual error from mysql and needed to restart but it wasn’t.

Solutions:

 Login to mysql, select your dbname, and use this command:

USE user_base;
REPAIR TABLE TABLE;