{"id":4695,"date":"2018-10-01T22:11:30","date_gmt":"2018-10-01T22:11:30","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/10\/01\/how-to-create-a-mysql-database-using-the-cpanel-api\/"},"modified":"2021-08-16T22:24:31","modified_gmt":"2021-08-17T02:24:31","slug":"how-to-create-a-mysql-database-using-the-cpanel-api","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/","title":{"rendered":"How to Create a MySQL Database Using the cPanel API"},"content":{"rendered":"<p>If you are running cPanel on your server, then you should use the cPanel API to create the database from the command line. Creating the database this way, allows for cPanel to integrate the necessary permissions for each cPanel user to access the databases they are granted access to.<\/p>\n\n\n\n<p>For instance, if you create a database from the command line using MySQL, the database will not appear in the cPanel interface or phpMyAdmin. In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#create\">Create a Database Using cPanel API<\/a><\/li><li><a href=\"#wizard\">cPanel MySQL\u00ae Database Wizard<\/a><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><div class=\"yt-LjamqoV4EqA\">\n\t<a class=\"play-video-LjamqoV4EqA\" style=\"position: relative; display: flex; flex-wrap: wrap; align-items: center; cursor: pointer;\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi_webp\/LjamqoV4EqA\/maxresdefault.webp\" width=\"1280\" height=\"720\" alt=\"How to Create a MySQL Database Using the cPanel API\" style=\"width: 100%; height: auto;\">\n\t\t<span class=\"fa fa-imh-play-circle imh-ds-icon play-circle\" style=\"position: absolute; display:block; font-size:150px; color: #c52228; opacity:0;\"><\/span>\n\t<\/a>\n<\/div><\/div>\n<\/div><figcaption>Don\u2019t have time to read the article? Watch our walk-through video.<\/figcaption><\/figure>\n\n\n<h2 id=\"create\">Create a Database Using cPanel API<\/h2>\n<ol class=\"article_list\">\n<li><a title=\"Click here to navigate to our guide and learn how to log into your server via SSH.\" href=\"\/support\/server\/ssh\/how-to-login-ssh\/\" target=\"_blank\" rel=\"noopener noreferrer\">Log into your server via SSH<\/a>.<\/li>\n<li>Run the following command to create the database:<code>uapi --user=exampl3 Mysql create_database name=db_name<\/code>\n<div class=\"alert alert-info\">\n<p><b>NOTE:<\/b> Be sure to replace <code>exampl3<\/code> with your actual cPanel username and <code>db_name<\/code> with the actual name you would like to give to the database.<\/p>\n<\/div>\n<\/li>\n<li>Run the following command to create the database user:<code>uapi --user=exampl3 Mysql create_user name=db_user password=P@s$w0rd123!<\/code>\n<div class=\"alert alert-info\">\n<p><b>NOTE:<\/b> Be sure to replace <code>exampl3<\/code> with your actual cPanel username, <code>db_user<\/code> with the actual name you would like to give to the database user, and <code>P@s$w0rd123!<\/code> to the actual password you would like to assign to this user.<\/p>\n<\/div>\n<\/li>\n<li>Assign the database user privileges to access the database by running the following command:<code>uapi --user=exampl3 Mysql set_privileges_on_database user=db_user database=db_name privileges=ALL<\/code>\n<div class=\"alert alert-info\">\n<p><b>NOTE:<\/b> Be sure to replace <code>exampl3<\/code> with your actual cPanel username, <code>db_user<\/code> with your actual database user, and <code>db_name<\/code> with the actual name of the database.<\/p>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"wizard\">cPanel MySQL\u00ae Database Wizard<\/h2>\n<p>The cPanel MySQL\u00ae 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: <a title=\"Click here to navigate to our guide and learn how to use the MySQL Database Wizard in cPanel to create a new MySQL database.\" href=\"\/support\/website\/create-database\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Create a MySQL Database in cPanel<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>If you are running cPanel on your server, then you should use the cPanel API to create the database from the command line. Creating the database this way, allows for cPanel to integrate the necessary permissions for each cPanel user to access the databases they are granted access to. For instance, if you create a<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\"> Read More ><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[51,4288,4305],"tags":[],"class_list":["post-4695","post","type-post","status-publish","format-standard","hentry","category-cpanel","category-website","category-databases"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create a MySQL Database Using the cPanel API | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a MySQL Database Using the cPanel API | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-01T22:11:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T02:24:31+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b\"},\"headline\":\"How to Create a MySQL Database Using the cPanel API\",\"datePublished\":\"2018-10-01T22:11:30+00:00\",\"dateModified\":\"2021-08-17T02:24:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\"},\"wordCount\":320,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"cPanel\",\"Website\",\"Working with Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\",\"name\":\"How to Create a MySQL Database Using the cPanel API | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-10-01T22:11:30+00:00\",\"dateModified\":\"2021-08-17T02:24:31+00:00\",\"description\":\"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a MySQL Database Using the cPanel API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/john-paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a MySQL Database Using the cPanel API | InMotion Hosting","description":"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a MySQL Database Using the cPanel API | InMotion Hosting","og_description":"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-10-01T22:11:30+00:00","article_modified_time":"2021-08-17T02:24:31+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b"},"headline":"How to Create a MySQL Database Using the cPanel API","datePublished":"2018-10-01T22:11:30+00:00","dateModified":"2021-08-17T02:24:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/"},"wordCount":320,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["cPanel","Website","Working with Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/","name":"How to Create a MySQL Database Using the cPanel API | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-10-01T22:11:30+00:00","dateModified":"2021-08-17T02:24:31+00:00","description":"In this guide, you can learn the commands to create a MySQL database, database user and password, as well as, assign all privileges to the user for the database using the cPanel API.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-mysql-database-using-the-cpanel-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Create a MySQL Database Using the cPanel API"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/john-paul\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4288,"name":"Website","slug":"website","link":"https:\/\/www.inmotionhosting.com\/support\/website\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4695"}],"version-history":[{"count":4,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4695\/revisions"}],"predecessor-version":[{"id":83599,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4695\/revisions\/83599"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}