Want live help from a dedicated Tech Agent?

Step 6: Setting up the database

A
Amal 7 months ago - Created

In this step we will set up and configure the MySQL database to work with the source code.


1. Install phpMyAdmin

Enter the following command to install phpMyAdmin.

sudo apt-get install phpmyadmin apache2-utils

You will be prompted with a (Y/n). Type y and press Enter.

Click ENTER

Click ENTER

You will be prompted to enter a password for phpMyAdmin. Enter a secure password and press Enter. Save this password.


sudo echo 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf
sudo service apache2 restart

Type your MySQL password you have given in Step 3 on prompt.


2. Create a database

Create a database.

After creating db you have to import the bitexchange.sql file.

(The sql file is present inside the bitexchange source code which you have downloaded)


After thet you have create user account.


3. Update the cfg file

We will update the cfg file in 4 different locations in the html directory:

  • frontend
  • admin
  • api
  • auth

First we will start with the admin folder.

Admin directory

Navigate to the admin directory by typing the below command in the Terminal and press Enter.

cd /var/www/html/admin

Open the cfg.php file inside this location with the following command:

sudo nano cfg.php 

You will see something like this:

Configure the else part:


Change the dbname from "bitexchange" to the name you have created before. In this case it was "cryptodb". And change the dbpass to the MySQL password. 

Once done, it will look like this:


Now save the file the file by pressing Control + O.

Press Enter.

And press Control + X to exit.

Now repeat the above process in the cfg file in api, auth, and cron directory.

Api directory

Navigate to the api directory by typing the below command in the Terminal and press Enter.

cd /var/www/html/api/cfg/

Open the cfg.php file inside this location with the following command:

sudo nano cfg.php 

Update the dbname and dbpass values. Save and close the file.

Auth directory

Navigate to the auth directory by using the below command:

cd /var/www/html/auth/

Open the cfg.php file inside this location with the following command:

sudo nano cfg.php 

Update the dbname and dbpass values. Save and close the file.

Cron directory

Navigate to the cron directory by using the below command:

cd /var/www/html/cron/

Open the cfg.php file inside this location with the following command:

sudo nano cfg.php 

Update the dbname and dbpass values. Save and close the file.

Frontend Directory

Now we need to change the URL in the cfg.php file in the frontend Directory. Navigate to the frontend directory by using the below command:

cd /var/www/html/frontend/cfg/

Open the cfg.php file inside this location with the following command:

sudo nano cfg.php

Your cfg.php file will look like this:


Rename the bitexchange.cash to yourexchangedomain.com. After you rename it should look like this:



You have now successfully setup the database. Visit Step 7: Create sessions folder to manage sessions during runtime.

Was this article helpful?

14 out of 14 found this helpful

Articles in this section