{"id":129988,"date":"2022-11-22T10:29:36","date_gmt":"2022-11-22T10:29:36","guid":{"rendered":"https:\/\/phppot.com\/?p=20034"},"modified":"2022-11-22T10:29:36","modified_gmt":"2022-11-22T10:29:36","slug":"phpmyadmin-how-to-create-a-database-2","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2022\/11\/22\/phpmyadmin-how-to-create-a-database-2\/","title":{"rendered":"phpMyAdmin \u2013 How to Create a Database?"},"content":{"rendered":"<div class=\"modified-on\" readability=\"7.1489361702128\"> by <a href=\"https:\/\/phppot.com\/about\/\">Vincy<\/a>. Last modified on November 22nd, 2022.<\/div>\n<p>PHPMyAdmin is one of the widely used database clients for PHP MySQL developers. It provides a simple user interface that can be easily adapted by beginners.<\/p>\n<p>We can blindly say that PHPMyAdmin as the de-facto database client used by PHP developers for MySQL \/ MariaDB. It is hugely popular and that is because of its simplicity and ease of use.<\/p>\n<p>It allows many database operations. Example,<\/p>\n<ol>\n<li>Creating databases and the corresponding tables.<\/li>\n<li>Adding and managing data.<\/li>\n<li>Altering the existing structure and attributes defined.<\/li>\n<li>Import, and export operations.<\/li>\n<\/ol>\n<p>In this article, we will see how to create a MySQL database using PHPMyAdmin.<\/p>\n<h2>How to create a database?<\/h2>\n<p>First login to the PHPMyAdmin client to go to the database control panel.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-20040\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-login.jpg\" alt=\"phpmyadmin login\" width=\"350\" height=\"417\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-login.jpg 350w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-login-252x300.jpg 252w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\"><\/p>\n<p>After login, it redirects to the PHPMyAdmin control panel which allows doing the following.<\/p>\n<ol>\n<li>To manage and manipulate MySQL database assets.<\/li>\n<li>To perform CRUD or other database-related operations.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20041\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-create-database-550x341.jpg\" alt=\"phpmyadmin create database\" width=\"550\" height=\"341\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-create-database-550x341.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-create-database-300x186.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-create-database-768x476.jpg 768w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-create-database.jpg 1000w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<p>If you want to see code to perform the MySQL <a href=\"https:\/\/phppot.com\/php\/how-to-create-php-crud-using-oops-with-mysqli-in-mvc\/\">database CRUD operations from a PHP application<\/a>, the linked article has the source,<\/p>\n<h2>Ways to create a database using PHPMyAdmin<\/h2>\n<p>There are 4 ways to create a new MySQL database using the PHPMyAdmin client interface.<\/p>\n<ol>\n<li>Via the left panel navigation.<\/li>\n<li>Via the header tab control navigation.<\/li>\n<li>By executing a CREATE statement via the SQL tab.<\/li>\n<li>By importing a CREATE statement SQL script via the Import tab.<\/li>\n<\/ol>\n<h2>1. Create database via left panel<\/h2>\n<p>In the PHPMyAdmin left panel, it contains a New link. It redirects to the page to create a new database.<\/p>\n<h2>2. Create database via header tab<\/h2>\n<p>The PHPMyAdmin UI shows tabs like Database, Import, Export and more. The Database tab redirects to show a list of existing databases with an option to create a new one.<\/p>\n<p>Both of these navigation controls will display the UI as shown in the figure.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-20042\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/database-create-form.jpg\" alt=\"database create form\" width=\"500\" height=\"140\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/database-create-form.jpg 500w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/database-create-form-300x84.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\"><\/p>\n<p>The database create-form shows two fields.<\/p>\n<ol>\n<li>To type the name of the database to be created.<\/li>\n<li>To choose a collation that is encoding type.<\/li>\n<\/ol>\n<p>In the above screenshot, the utf8_unicode_ci collation is selected.<\/p>\n<p>The other two methods are for the one who has the SQL script for creating a new MySQL database.<\/p>\n<p>Sometimes the database SQL will be provided. In that case, it is not required to use the interface to input the database name and the collation.<\/p>\n<h2>3. Create database via SQL tab, by running a CREATE SQL query<\/h2>\n<p>Choose the SQL tab from the PHPMyAdmin header. It will show a textarea to paste the CREATE database query.<\/p>\n<p>Then, execute the entered query to see the created database among the existing list.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20043\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-sql-tab-550x295.jpg\" alt=\"phpmyadmin sql tab\" width=\"550\" height=\"295\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-sql-tab-550x295.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-sql-tab-300x161.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-sql-tab.jpg 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<h2>4. Create database via Import tab, by uploading a SQL script<\/h2>\n<p>If you have the database CREATE statement Choose the Import tab from the PHPMyAdmin header. Then browse the SQL script that contains the CREATE statement.<\/p>\n<p>Then click the \u201cGo\u201d button to process the import. It will result in displaying a new database imported.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20044\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-import-database-550x257.jpg\" alt=\"phpmyadmin import database\" width=\"550\" height=\"257\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-import-database-550x257.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-import-database-300x140.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/phpmyadmin-import-database.jpg 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<p>We have seen PHP code for <a href=\"https:\/\/phppot.com\/php\/import-excel-file-into-mysql-database-using-php\/\">importing Excel data into a database<\/a> using a custom code.<\/p>\n<h2>After creating a MySQL database<\/h2>\n<p>After creating a MySQL database using PHPMyAdmin, the next job is to start adding the tables.<\/p>\n<p>The PHPMyAdmin has the option to \u201cCheck privileges\u201d to map roles and MySQL database operations.<\/p>\n<p>But, this is a rarely used feature. If the database is associated with more than one user, then this feature will be used.<\/p>\n<h2>How to create tables in a database?<\/h2>\n<p>After creating a database, the PHPMyAdmin shows a form to a create table. That form show fields to enter the table name and the number of columns of the table.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20050\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-database-table-550x213.jpg\" alt=\"create database table\" width=\"550\" height=\"213\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-database-table-550x213.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-database-table-300x116.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-database-table.jpg 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<p>After specifying the table name and the \u201cNumber of columns\u201d, the PHPMyAdmin panel will show inputs to add the table column specification.<\/p>\n<p>See the following screen that is added with the column names with their corresponding types and more details.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20051\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-table-column-550x288.jpg\" alt=\"create table column\" width=\"550\" height=\"288\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-table-column-550x288.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-table-column-300x157.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-table-column.jpg 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<h2>Add user accounts and set privileges<\/h2>\n<p>Select the \u201cUser accounts\u201d tab to see the number of existing user accounts. The PHPMyAdmin also allows adding a new user via the interface.<\/p>\n<p>The \u201cCreate user\u201d page will have the option to select the user account details and set the permission to perform operations like,<\/p>\n<ul>\n<li>CRUD operations on the <strong>Data<\/strong>.<\/li>\n<li>CREATE, ALTER, DROP and more operations on the MySQL database <strong>Structure<\/strong>.<\/li>\n<li>Access&nbsp;<strong>Administration<\/strong> tools.<\/li>\n<li>Setting resource limits like making the number of simultaneous connections.<\/li>\n<\/ul>\n<p>See the screenshot below to allow or deny access permissions of the user created for a MySQL database.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-20057\" src=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-and-set-privileges-550x499.jpg\" alt=\"create and set privileges\" width=\"550\" height=\"499\" srcset=\"https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-and-set-privileges-550x499.jpg 550w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-and-set-privileges-300x272.jpg 300w, https:\/\/phppot.com\/wp-content\/uploads\/2022\/11\/create-and-set-privileges.jpg 600w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\"><\/p>\n<p> <!-- #comments --> <\/p>\n<p> <a href=\"https:\/\/phppot.com\/mysql\/phpmyadmin-create-database\/#top\" class=\"top\">\u2191 Back to Top<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>by Vincy. Last modified on November 22nd, 2022. PHPMyAdmin is one of the widely used database clients for PHP MySQL developers. It provides a simple user interface that can be easily adapted by beginners. We can blindly say that PHPMyAdmin as the de-facto database client used by PHP developers for MySQL \/ MariaDB. It is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":129989,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[],"class_list":["post-129988","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-updates"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/129988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=129988"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/129988\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/129989"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=129988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=129988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=129988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}