How to create database, database username and grant all rights on cPanel server via command line using UAPI

You can create a database, database user, and grant privileges using the cPanel User API (UAPI) command line interface.

Connect to your cPanel account using SSH.

Type the following command to create a new database:

uapi --user='cpanel_username' Mysql create_database name='database_name'

Replace ‘cpanel_username‘ with your cPanel account username and ‘database_name‘ with the name of the database you want to create.… Read the rest

How to create a MySQL database, username, password and privileges from the mysql command line

Login to MySQL with root privileges

root@server [~]# mysql

Create the Database

mysql > create database cleint_dbname;

Create the User

mysql > create user cleint_dbuser;

Grant privileges for this chain database + database username + password

mysql > grant all on client_dbname.*

Read the rest