• TechOps

    Need clarity?
    Chat with our experts now

    • Web Hosting SupportWeb Hosting Support
    • Helpdesk Support

      Skilled and professional 24/7 helpdesk support

    • Product Support

      Boost your product support with our expertise

    • Managed ServicesManaged Services
    • Server Management

      Don't let server issues slow you down. Let us manage them for you

    • Server Monitoring

      Safeguard your server health with our comprehensive monitoring solutions

    • Staff AugmentationStaff Augmentation
    • Hire an Admin

      Transform your business operations with our expert administrative support

    • Hire a Team

      Augment your workforce with highly skilled professional from our diverse talent pool

  • CloudOps

    Confused?
    Discuss with our sales team now.

    • Author ProfileAWS
      Well Architected Review
    • Author ProfileFinOps As a Service

      FinOps As a Service

    • Migrate

      Upgrade the journey: Migrate & Modernize seamlessly

    • Modernize

      Effortless CloudOps mastery for seamless cloud management

    • Optimize

      Efficient CloudOps: Boosting performance through optimization

    • Manage

      Simplify compliance complexities with our dedicated service

  • DevOps

    How Supportsages
    is creating an
    impact?

    View Casestudies
    • Author Profile24/7 DevOps As a Service

      Round-the-clock DevOps for uninterrupted efficiency

    • Author ProfileCI/CD Pipeline

      Automated CI/CD pipeline for seamless deployments

    • Author ProfileInfrastructure As a Code

      Crafting infrastructure with ingenious code

    • Author ProfileDevSecOps

      Integrated security in continuous DevOps practices

    • Author ProfileHire DevOps Engineers

      Level up your team with DevOps visionaries

    • Author ProfileConsulting Services

      Navigate success with expert DevOps consulting

  • SecOps

    Expert SecOps Services
    for any Scale

    • Author ProfileVAPT

      Vulnerability Assessment and Penetration Testing

    • Author ProfileSource Code Review

      Ensuring source code security and safe practices to reduce risks

    • Author ProfileSecurity Consultation

      On demand services for improving server security

    • Author ProfileSystem Hardening

      Reduced vulnerability and proactive protection

    • Author ProfileManaged SOC

      Monitors and maintains system security. Quick response on incidents

    • Author ProfileCompliance as a Service

      Regulatory compliance, reduced risk

  • Insights

    Explore our latest
    insights and resources

    Blog

    Explore our latest articles and insights

    Case Studies

    Read about our client success stories

  • Contact Us

  • About
  • Certifications
  • Life at Supportsages
  • Events
  • Contact
  • Careers
  • Blog

  • Dedicated Support Team
  • Quasi-dedicated Support Team
  • Hire a DevOps Engineer
  • Hire a Billing Support Staff
  • Per-ticket Support Plan
  • Managed Services

  • Microsoft Azure Expert
  • AWS Cloud Expert
  • Hire a developer
SS

SupportSages

Bites of wisdom @ work


Copyright © 2008 - 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy
How to create MySQL user and database from command line of a cPanel server

How to create MySQL user and database from command line of a cPanel server

Abhilash Padmanabhan

  • 2 min read
How to create MySQL user and database from command line of a cPanel server

Generating audio, please wait...

cPanel has made everyone’s life easy. But a few sysadmins won’t get the kick of “IT” when they work on a cPanel server. cPanel is fun and is defining professionalism in their support, Paper lantern UI and in every other area, I can think of, as each day passes. The MySQL create user and create database functions are available in the cPanel frontend.

But today I needed to create a DB from the backend, I am fully aware that APIs exist for my job, but needed something quick to create the MySQL db from the backend. I remember issuing a command similar to /scripts/createmysqldb or so, but didn’t see it today. Guess cPanel removed it. Here it goes – the three step process

Step 1.
Let’s create the DB first.

root@server [/etc]# sudo -u cp-username-of-the-domain /usr/local/cpanel/bin/cpmysqlwrap  ADDDB cp-username-of-the-domain_database

It will show a message saying similar to below, assuming you have given cp-username-of-the-domain_database as testuser_db

info [cpmysqladmin] Creating MySQL database testuser_db for user testuser

Step 2.
Now create the DB user.

root@server [/etc]# sudo -u cp-username-of-the-domain /usr/local/cpanel/bin/cpmysqlwrap  ADDUSER cp-username-of-the-domain_user

Above command should show an output similar to below. Assumption again, cp-username-of-the-domain_user is testuser_user

info [cpmysqladmin] Creating MySQL virtual user testuser_user for user testuser

Step 3.
Finally, adding all privileges for the user to the DB.

root@server [/etc]# sudo -u cp-username-of-the-domain /usr/local/cpanel/bin/cpmysqlwrap  ADDUSERDB 'cp-username-of-the-domain_user' 'cp-username-of-the-domain_database' ALL

Surprisingly, this won’t give you any console outputs. But you can check the existence of DB by logging to MySQL prompt.

Get 24/7 expert server management

  • cPanel
  • Linux
  • MySQL
  • Looking for AWS Experts?

    We provide top-of-the-line custom AWS setup services tailored to your needs.

    500 Internal Server due to low RLimitMem value

    SupportSages Logo
    • Apache
    • cPanel
    • General
    • Linux
    logo

    Change all user account passwords in a cPanel server

    Change all user account passwords in a cPanel server
    • cPanel
    • Linux
    • Snippets
    logo

    cPanel, postgresql and a default database issue with 8.4.x versions of postgres

    SupportSages Logo
    • cPanel
    • PostgreSQL
    • Troubleshooting
    logo

    CRITICAL : Serious kernel bug!!! Root privilege escalation

    SupportSages Logo
    • Linux
    • VPS
    logo

    Posts by Abhilash Padmanabhan

    Technology always fascinated me and continues to do so. I started my career back in 2004 as a Junior System Admin and worked in various capacities both in technical and managerial roles. I love to experiment and try out new OSS projects and in free time, go for cycling to the interiors of God's own country, Kerala!