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 the same password which you have used during mysql installation in Step: 3 and press Enter. Save this password.
sudo echo 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf
sudo service apache2 restart
Login to phpmyadmin:
If you have pointed your exchange to a domain name: https://domain_name/phpmyadmin
If you have pointed your exchange to a ip address: http://ip_address/phpmyadmin
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.