Install and configure MySQL, PostgreSQL, or Redis on your server.
apt update
apt install mysql-server -y
mysql_secure_installation
apt update
apt install mysql-server -y
mysql_secure_installation
CREATE DATABASE myapp;
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON myapp.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;
CREATE DATABASE myapp;
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON myapp.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;
Edit /etc/mysql/mysql.conf.d/mysqld.cnf:
[mysqld]
innodb_buffer_pool_size = 4G # 50-70% of available RAM
innodb_log_file_size = 512M
max_connections = 200
query_cache_size = 64M
[mysqld]
innodb_buffer_pool_size = 4G # 50-70% of available RAM
innodb_log_file_size = 512M
max_connections = 200
query_cache_size = 64M
apt update
apt install postgresql postgresql-contrib -y
systemctl enable postgresql
apt update
apt install postgresql postgresql-contrib -y
systemctl enable postgresql
sudo -u postgres psql
CREATE DATABASE myapp;
CREATE USER appuser WITH ENCRYPTED PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE myapp TO appuser;
sudo -u postgres psql
CREATE DATABASE myapp;
CREATE USER appuser WITH ENCRYPTED PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE myapp TO appuser;
apt update
apt install redis-server -y
apt update
apt install redis-server -y
Edit /etc/redis/redis.conf:
maxmemory 2gb
maxmemory-policy allkeys-lru
requirepass your_redis_password
maxmemory 2gb
maxmemory-policy allkeys-lru
requirepass your_redis_password
redis-cli
AUTH your_redis_password
PING
# Response: PONG
redis-cli
AUTH your_redis_password
PING
# Response: PONG