Skip to content

Latest commit

 

History

History
executable file
·
93 lines (65 loc) · 2.85 KB

File metadata and controls

executable file
·
93 lines (65 loc) · 2.85 KB

Database

This project requires a Mysql server.

Install

sudo apt install mysql-server

Config

Run mysql secury script to configure to your liking

sudo mysql_secure_installation

Remote control

We have to open up mysql server to listen to the correct bind.

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Modify that bind-address from: 127.0.0.1 to 0.0.0.0

Execute mysql as root and then show all users.

sudo mysql

SELECT User, Host FROM mysql.user;

Add root account to remote control mysql server with your ip.

CREATE USER 'root'@'<your_ip>' IDENTIFIED WITH mysql_native_password BY '<your_password>';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'<your_ip>' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Create backend account to run bf2mc server with.

CREATE USER 'backend'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bf2mcbackend2023';
GRANT SELECT, INSERT, UPDATE, DELETE ON `BF2MC`.* TO `backend`@`localhost`;
GRANT EXECUTE ON PROCEDURE BF2MC.* TO 'backend'@'localhost';
FLUSH PRIVILEGES;

And create webserver account to run Gee his website with:

CREATE USER 'webserver'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bf2mcbackend2023';
GRANT SELECT ON `BF2MC`.* TO `webserver`@`localhost`;
GRANT EXECUTE ON PROCEDURE BF2MC.* TO 'webserver'@'localhost';
FLUSH PRIVILEGES;

Last we patch the firewall.

sudo ufw allow from <myip> to any port 3306

Remote control

I use Mysql Workbench to remote control the database server.

Connect

Use fill in your ip, port and username to connect to the database.

Create schema

Once your logged in you can see your server stats. On the left bottom you will click tab Schema. Then right click and create a new Schema.

-

Call it "BF2MC" and click Apply.

Now we go back to administration tab and click "Data import".

  • Step 1: Select the project database folder.
  • Step 2: Click "Load folder Contents"
  • Step 3: Select BF2MC database
  • Step 4: Make sure all the tables are selected.
  • Step 5: Click "Start Import"

Now we go back to the "Schema" tab. Right click "BF2MC" database and click "Refresh All". Now all the tables will be shown up and your good to go to run the server.