---
title: 'Hosting: Creating databases by api in Cpanel | Zomro'
description: 'How to quickly create databases and users on hosting with Cpanel. Adding databases and users is not very convenient to do from the control panel...'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a43@server-panel.net/2022/06/01/1656172970_1656172932281.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Hosting: Creating databases by api in Cpanel 



# Hosting: Creating databases by api in Cpanel

25-06-2022

![Hosting: Creating databases by api in Cpanel - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a43@server-panel.net/2022/06/01/1656172970_1656172932281.png)  
Adding databases and users is not very convenient to perform from the control panel, especially with a large number. This can be simplified using the api.  
At the time of this writing, to console has access at all tariffs except "AFFORDABLE".  
You can connect to the hosting to execute commands using the "Security - SSH Access" key or from the "Advanced - Terminal" web interface itself.  
  
Create database:
    
    
    uapi Mysql create_database name="**userprefix_DBname** "

Create a user and specify a password for it:
    
    
    uapi Mysql create_user name="**userprefix_DBuser** " password="**yourpassword** "
    

Adding a database to a user:
    
    
    uapi Mysql set_privileges_on_database user="**userprefix_DBuser** " database="**userprefix_DBname** " privileges=ALL PRIVILEGES

You need to change the data to yours:  
**userprefix** \- user prefix (your login)  
**DBname** \- database name  
**DBuser** \- username to connect  
**yourpassword** \- the password for the new mysql user  
  
When using a simple password, you may get an error:

This system does not allow the given password for “MySQL Users” because it is too weak and would be too easy to crack. Please select a password with strength rating of 65 or higher.

  
Run the command again specifying a more strong password.

Similar articles:

[Creating Minecraft Java Servers.](https://zomro.com/blog/faq/325-creating-minecraft-java-servers) [cPanel: creating a mailbox and working with it](https://zomro.com/blog/faq/222-cpanel-sozdanie-pochtovogo-jaschika-i-rabota-s-nim) [How to install and configure fail2ban in Ubuntu 20.04](https://zomro.com/blog/faq/365-how-to-install-and-configure-fail2ban-in-ubuntu-2004) [Databases in cPanel](https://zomro.com/blog/faq/178-bazy-dannyh-v-cpanel) [Upgrading and downgrading PHP on CentOS 7](https://zomro.com/blog/faq/434-upgrading-and-downgrading-php-on-centos-7)

[ GPU server from €174.80/mon ](/dedicated-servers/type=gpu)
