Prepare MySQL Database

Prepare MySQL Database

Before installing the Platfone NodeJS Backend, follow these steps to set up your MySQL (MariaDB) database.

  • Step 1: Install MySQL or MariaDB server
  • Step 2: Create a new database and user
  • Step 3: Run database migrations

Step 1: Install MySQL or MariaDB server

Install a MySQL-compatible database server (MySQL 5.7+ or MariaDB 10+). Refer to your vendor documentation for platform-specific instructions.

Step 2: Create a new database and user

Log in to your database:

mysql -u root -p

Then run the following SQL statements (adjust names and credentials as needed):

CREATE DATABASE platfone;
CREATE USER 'platfone_user'@'%' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON platfone.* TO 'platfone_user'@'%';
FLUSH PRIVILEGES;

Step 3: Run database migrations

The database schema for the Platfone NodeJS Backend is managed via migrations. To apply the schema, run the following from the repository root:

npm install
npm run build

# Copy environment template and update values
cp .env.example .env
# Edit .env with your API key, database connection, and payment gateway settings

# Run database migrations
npm run migrate