Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

MySQL database

padre edited this page Sep 15, 2024 · 3 revisions

How to Create a MySQL Database and Connect to It

Step 1: Create the Database

To create a MySQL database for use with PremiumPoints or any other plugin, follow these steps:

1.1 Log into MySQL as root

Open your terminal and enter the following command:

mysql -u root -p

You will be prompted to enter the root password for MySQL. After entering the password, you will be logged into the MySQL shell.

1.2 Create the playerpoints database

Once you are in the MySQL shell, create a new database by running:

CREATE DATABASE playerpoints;

1.3 Verify the database was created

To check if the database was created successfully, list all databases:

SHOW DATABASES;

You should see playerpoints in the list.

1.4 Exit MySQL

Once you've confirmed the database is created, you can exit the MySQL shell:

EXIT;

Step 2: Set a Password for the Database

PlayerPoints (or other plugins) may not function properly if there’s no password set for the database.

2.1 Access MySQL with superuser privileges

In your terminal, run:

sudo mysql

This will open the MySQL shell as a superuser.

2.2 Set a password for the root user

To set a password for the root user, run the following command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';

Make sure to replace 'your_password' with your actual password.

2.3 Apply the changes

After setting the password, apply the changes:

FLUSH PRIVILEGES;

2.4 Exit MySQL

Finally, exit the MySQL shell:

EXIT;

If you ever want to export your MySQL database:

mysqldump -u root -p playerpoints > playerpoints.sql

Now your MySQL database is ready, and you can use it with PremiumPoints or other plugins. Make sure to update your plugin configuration to point to the new database and use the password you've set.