View Single Post
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-03-2022 , 19:39   Re: [ANY] Timezone API
Reply With Quote #6

Definitely, you need to connect to your database before doing anything to it.
host is ip, username, password are self-explained, other fields are optional, default schema is a database name. If you don't have any yet, you need to login as root and create new database using command:
Code:
CREATE DATABASE my_db;
Then select this database in upper right pane, or using command:
Code:
USE my_db;
After that, import .sql as described before, e.g. from File -> Import Script, or through RCON:
Code:
mysql -u USERNAME -pPASSWORD timezonedb < time_zone.sql
That is a very basic knowledge on working with db.
https://www.mysqltutorial.org/mysql-create-database/

Also, there are some settings in MySQL preventing from connection to it outside the localhost. You should handle it by applying GRANT ALL PRIVILEGES command (see below).

If you are hosting from VPS (Linux) and you don't have installed MySQL service at all, here is a short instruction from me about how to install required packages and make a basic setup of your first database to be able connect remotely:

The following commands executed in RCON:

MySQL service installation:
Refer to: https://timeweb.com/ru/community/art...na-debian-10-1

Code:
sudo apt install gnupg
cd /tmp
wget https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb
sudo dpkg -i mysql-apt-config*
sudo apt update
sudo apt install mysql-server
sudo systemctl status mysql
mysql_secure_installation
Database creation:
Code:
mysql -u root -pPASSWORD
where:
* PASSWORD - is a password of your root user set during MySQL service installation stage.

PHP Code:
create database my_db;
use 
my_db;
show tables;
CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON my_db.* TO 'my_user'@'%';
// it is required to be able connect using the old method of authentification
ALTER USER 'my_user'@'%' IDENTIFIED BY 'my_password' PASSWORD EXPIRE NEVER;
ALTER USER 'my_user'@'%' IDENTIFIED WITH mysql_native_password BY 'my_password';
FLUSH PRIVILEGES;
quit 
where:
* my_db - name of desired database
* my_user - name of desired user
* my_password - desired password of that user

Surely, some steps could be done by simple clicks using GUI tools like phpMyAdmin.

Also, you'll have to configure firewall to allow MySQL port connections:
Code:
apt-get update
apt-get install iptables-persistent
iptables -A OUTPUT -p tcp -m tcp --dport 3306 -j ACCEPT
dpkg-reconfigure iptables-persistent
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 12-03-2022 at 19:57.
Dragokas is offline