How to Create a Database Using cPanel API

Announcement

Log into your server via SSH.

Run the following command to create the database:

uapi --user=exampl3 Mysql create_database name=db_name

NOTE: Be sure to replace exampl3 with your actual cPanel username and db_name with the actual name you would like to give to the database.

Run the following command to create the database user:

uapi --user=exampl3 Mysql create_user name=db_user [email protected]$w0rd123!

NOTE: Be sure to replace exampl3 with your actual cPanel username, db_user with the actual name you would like to give to the database user, and [email protected]$w0rd123! to the actual password you would like to assign to this user.

Assign the database user privileges to access the database by running the following command:

uapi --user=exampl3 Mysql set_privileges_on_database user=db_user database=db_name privileges=ALL

NOTE: Be sure to replace exampl3 with your actual cPanel username, db_user with your actual database user, and db_name with the actual name of the database.

cPanel MySQL® Database Wizard

The cPanel MySQL® Database Wizard creates a database, as well as a database user and password. The Wizard also completes the process of assigning privileges to the database user (to use the database as needed). For step-by-step instructions you can refer to our guide

Leave a Reply

Your email address will not be published. Required fields are marked *