Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] phpMyAdmin – How to Create a Database?

#1
phpMyAdmin – How to Create a Database?

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2022/11/phpmyadmin-how-to-create-a-database.jpg" width="350" height="417" title="" alt="" /></div><div><div class="modified-on" readability="7.1489361702128"> by <a href="https://phppot.com/about/">Vincy</a>. Last modified on November 22nd, 2022.</div>
<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>
<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>
<p>It allows many database operations. Example,</p>
<ol>
<li>Creating databases and the corresponding tables.</li>
<li>Adding and managing data.</li>
<li>Altering the existing structure and attributes defined.</li>
<li>Import, and export operations.</li>
</ol>
<p>In this article, we will see how to create a MySQL database using PHPMyAdmin.</p>
<h2>How to create a database?</h2>
<p>First login to the PHPMyAdmin client to go to the database control panel.</p>
<p><img 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/20...52x300.jpg 252w" sizes="(max-width: 350px) 100vw, 350px"></p>
<p>After login, it redirects to the PHPMyAdmin control panel which allows doing the following.</p>
<ol>
<li>To manage and manipulate MySQL database assets.</li>
<li>To perform CRUD or other database-related operations.</li>
</ol>
<p><img 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/20...00x186.jpg 300w, https://phppot.com/wp-content/uploads/20...68x476.jpg 768w, https://phppot.com/wp-content/uploads/20...tabase.jpg 1000w" sizes="(max-width: 550px) 100vw, 550px"></p>
<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>
<h2>Ways to create a database using PHPMyAdmin</h2>
<p>There are 4 ways to create a new MySQL database using the PHPMyAdmin client interface.</p>
<ol>
<li>Via the left panel navigation.</li>
<li>Via the header tab control navigation.</li>
<li>By executing a CREATE statement via the SQL tab.</li>
<li>By importing a CREATE statement SQL script via the Import tab.</li>
</ol>
<h2>1. Create database via left panel</h2>
<p>In the PHPMyAdmin left panel, it contains a New link. It redirects to the page to create a new database.</p>
<h2>2. Create database via header tab</h2>
<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>
<p>Both of these navigation controls will display the UI as shown in the figure.</p>
<p><img 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/20...300x84.jpg 300w" sizes="(max-width: 500px) 100vw, 500px"></p>
<p>The database create-form shows two fields.</p>
<ol>
<li>To type the name of the database to be created.</li>
<li>To choose a collation that is encoding type.</li>
</ol>
<p>In the above screenshot, the utf8_unicode_ci collation is selected.</p>
<p>The other two methods are for the one who has the SQL script for creating a new MySQL database.</p>
<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>
<h2>3. Create database via SQL tab, by running a CREATE SQL query</h2>
<p>Choose the SQL tab from the PHPMyAdmin header. It will show a textarea to paste the CREATE database query.</p>
<p>Then, execute the entered query to see the created database among the existing list.</p>
<p><img 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/20...00x161.jpg 300w, https://phppot.com/wp-content/uploads/20...ql-tab.jpg 600w" sizes="(max-width: 550px) 100vw, 550px"></p>
<h2>4. Create database via Import tab, by uploading a SQL script</h2>
<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>
<p>Then click the “Go” button to process the import. It will result in displaying a new database imported.</p>
<p><img 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/20...00x140.jpg 300w, https://phppot.com/wp-content/uploads/20...tabase.jpg 600w" sizes="(max-width: 550px) 100vw, 550px"></p>
<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>
<h2>After creating a MySQL database</h2>
<p>After creating a MySQL database using PHPMyAdmin, the next job is to start adding the tables.</p>
<p>The PHPMyAdmin has the option to “Check privileges” to map roles and MySQL database operations.</p>
<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>
<h2>How to create tables in a database?</h2>
<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>
<p><img 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/20...00x116.jpg 300w, https://phppot.com/wp-content/uploads/20...-table.jpg 600w" sizes="(max-width: 550px) 100vw, 550px"></p>
<p>After specifying the table name and the “Number of columns”, the PHPMyAdmin panel will show inputs to add the table column specification.</p>
<p>See the following screen that is added with the column names with their corresponding types and more details.</p>
<p><img 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/20...00x157.jpg 300w, https://phppot.com/wp-content/uploads/20...column.jpg 600w" sizes="(max-width: 550px) 100vw, 550px"></p>
<h2>Add user accounts and set privileges</h2>
<p>Select the “User accounts” tab to see the number of existing user accounts. The PHPMyAdmin also allows adding a new user via the interface.</p>
<p>The “Create user” page will have the option to select the user account details and set the permission to perform operations like,</p>
<ul>
<li>CRUD operations on the <strong>Data</strong>.</li>
<li>CREATE, ALTER, DROP and more operations on the MySQL database <strong>Structure</strong>.</li>
<li>Access&nbsp;<strong>Administration</strong> tools.</li>
<li>Setting resource limits like making the number of simultaneous connections.</li>
</ul>
<p>See the screenshot below to allow or deny access permissions of the user created for a MySQL database.</p>
<p><img 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/20...00x272.jpg 300w, https://phppot.com/wp-content/uploads/20...ileges.jpg 600w" sizes="(max-width: 550px) 100vw, 550px"></p>
<p> <!-- #comments --> </p>
<p> <a href="https://phppot.com/mysql/phpmyadmin-create-database/#top" class="top">↑ Back to Top</a> </p>
</div>


https://www.sickgaming.net/blog/2022/11/...atabase-2/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016