Koken database connection errors

Are you getting a database error in Koken similar to this? Koken connection error

Connection error

Cannot connect to the API. Error message:
Database connection failed. Make sure the database server is running and the information in storage / configuration / database.php is still correct.

This means that Koken is unable to connect to your database due to a bad username, password, database name, or other possible issues. In this tutorial, we will walk you through the process of troubleshooting and resolving the issue. Before you know it, your database connection issues will be solved and you will be up and running shortly.

Check your database user, password, and database name

The most common reason for a database connection error in Koken is due toa bad username, password, or database name within your Koken database configuration file.

Locate and open your Koken database.php file

  1. All of your Koken database configuration information is stored within a file named database.php. This file is located within your Koken installation at:

    /storage/configuration/database.php

  2. database.php file

    The quickest and easiest way to open and edit the file would be within the cPanel File Manager. First, log into cPanel, open the File Manager, and browse for the configuration file.

  3. code edit database.php

    Next, you will just need to open the file. Right-click the Koken database.php file and click on Code Editor.

  4. code editor screenshot

    Now, you will see the full configuration file. In each field, you will see entries for the Koken database connection settings. Check over the database username, password, and database name to ensure that all of the information is correct within there. Any incorrect information here will cause a database connection error in Koken.

What if I don’t know my database connection settings?

MySQL Databases screen

If you are unsure of your database connection settings, you can gain that infromation within cPanel by clicking on MySQL Databases. From here, it will list all of your databases as well as the user assigned to it. If you do not see a user assigned to your Koken database, you will need to either create one or assign an existing user with all permissions at the bottom of the MySQL Databases page.

set MySQL User Password

If you are unsure of your password, unfortunately, there is not a way to obtain the existing password. You will need to reset the password for that specific user that is assigned to the Koken database. You may do so by clicking on the user within the lsit to the bottom of the MySQL Databases section of cPanel to reset your password. After you reset the password, be sure to adjust your database.php file within Koken.

Incorrect user permissions to your Koken database

Add MySQL User

If your Koken database settings are indeed correact, you may not have the user assigned to the database or you may not have the correct permissions to access the Koken database. To resolve that issue, make sure that you see a user defined within your MySQL Databases section of cPanel for your Koken database. In the list of your databases, you should see your Koken database with the user that is assigned to it on the right of it. If you do not have a user, you will need to create the database user for that specific database or assign an existing one.

If you do have a database user defined to the right of your Koken database, make sure that this user has the correct permissions. On that same section of cPanel that we were previously in, you will see a section that says “Add User to Database”. Selecty your database user as well as your Koken databasse and click on Add. Here, you may then add all privileges to the database.

Check your Koken database prefix

database table list

While rare, your database prefix could be incorrect. Within the previous database.php file for Koken, you will see a line that says “prefix”. This database prefix determines what every field within your database starts with. To see what your current Koken database prefix is, you may log into PHPMyAdmin and select your Koken database. You will notice that each field in the database starts with something specific such as “koken_”. Be sure that this matches your prefix within your Koken database.php file.

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X