XAMPP phpMyAdmin: How to Create Database and Tables
It’s always recommended to install XAMPP and test your project locally before making it live for users. If installing and configuring XAMPP phpMyAdmin on your local machine is bothering you, then reading this post will help you figure it out.
XAMPP is an open source server set up to test the projects on a local server before making it available to everyone over the web. This web app development server comes pre-installed with Apache web server, MySQL database, PHP, and Perl that help you build an offline application with desired features and functions. XAMPP is a lightweight solution that works perfectly on multiple platforms likes Linux, Windows, and Mac OS.
Most of the developers rely on XAMPP to test their new plugins, check updates, test new themes before implementing any change to the live version. This way developers anticipate any error or issue that might occur. Let’s now dig a little deeper and move towards phpMyAdmin to understand the data flow.
XAMPP phpMyAdmin What it is?
phpMyAdmin is a free and open source software that lets you handle the administration of MySQL over the web. You can easily manage the database through a graphic user interface known as phpMyAdmin in this case. phpMyAdmin is written in PHP and has gained a lot of popularity in terms of web-based MySQL management solution. You can perform operations on MySQL via phpMyAdmin user interface while you can still directly execute SQL queries. And it lets you carry out operations like editing, creating, dropping, amend MySQL database, alter fields, tables, indexes, etc. In fact, which user should be given what privileges, you can manage that too. phpMyAdmin has huge multi-language community support.
Create Database on XAMPP phpMyAdmin
phpMyAdmin support a wide range of MySQL operations which makes working with database easy and simple. Moreover, the interactive user interface of phpMyAdmin helps you manage the queries pretty easily. In order to create a XAMPP MySQL database, you need to launch XAMPP first.
Now navigate to http://localhost/phpmyadmin
And click on the Database tab. Now you should see the option to Create a Database and input field to enter the database name. Write the database name and hit the ‘Create’ button. You will see a success message in a while.
From the list of tables, you can view your database. You are free to use this database wherever you like with default settings. By default the HostName is ‘localhost’, MySQL user is ‘root’ and have no password.
Create Tables Using phpMyAdmin XAMPP
Tables play a vital role in the storage of information (dynamic content). On XAMPP MySQL store the information in the tables. You can easily add tables to MySQL using the intuitive phpMyAdmin user interface. In the phpMyAdmin click on the ‘Structure’ tab. Below the tables list at the bottom of the page, click on the ‘Create new table on database’ wizard to get started. First, add the table name and the total number of fields and hit the ‘Go’ button.
This way you will be launched to a step-by-step wizard where you need to fill up the required fields. First off, name all the fields and select the relevant type for every field. However, in order to choose the type, use ‘Type’ drop-down menu and fill a value for the length of each field. Next, assign ‘Attribute’ to each field. From the ‘Null’ drop-down menu select the null option and define whether the specified field is a primary key or not. And finally, select the table type and collation method and click the ‘Save’ button to finish the table creation process.
Set Password to phpMyAdmin on XAMPP
When we install the XAMPP server on a local machine, by default the username is ‘root’ and the password remains empty. Since it is a local server that’s why developers don’t set any password. However, it’s entirely your choice to set or change the password to phpMyAdmin on XAMPP. If you want to set a password you can follow the following steps.
- Start the XAMPP server by clicking on the ‘Start’ button parallel to MySQL and Apache server like shown below.
- Parallel to MySQL in the Actions column, click on the ‘Admin’ button. And this will open a page whose URL will be localhost/phpmyadmin. However, you can directly open this page simply by entering this URL in the browser.
- On this page, click on the ‘User accounts’ option at the top of the page.
- Now press the ‘Edit Privileges’ under ‘Actions’ option for the Username ‘root’ and Hostname ‘localhost.’
- Now choose the third tab ‘Change password’ and type your password in the provided field, retype the password to confirm it and then finally click on the ‘Go’ key to conclude the process.
That’s how you can set a password to phpMyAdmin XAMPP!!
Import / Export Database on XAMPP phpMyAdmin
In order to manage the MySQL database, phpMyAdmin provides you an efficient platform. You can handle the data from anywhere using phpMyAdmin. Moreover, the capability to import & export database gives you the best chance to recover from any sudden or unavoidable data loss. Likewise, migrating data from one server to another can be done flawlessly. It is a web-based interface that allows you to recover the data from anywhere.
Import Database on XAMPP phpMyAdmin
However, it is easy to import or export data and the following steps can help you with that. So to import the database using phpMyAdmin XAMPP carry out the following steps.
- Open the Database in phpMyAdmin.
- Click on the Databases from the top menu.
- Select the name of the database from the drop-down menu which you want to import.
- Click on the Import tab.
- Browse your .sql file by clicking on the ‘Choose File’ option that you wish to import. And then click on the ‘Go’ button at the bottom.
- You’re done!!
You have successfully imported the database if the syntax of your .sql file is correct, now you should see a confirmation message on your screen. Similarly, you can see the tables in the column to the left in the phpMyAdmin interface.
Export Database on XAMPP phpMyAdmin
In order to export MySQL database via phpMyAdmin XAMPP, follow the following step.
- To begin the export process, log in to the cPanel and open the phpMyAdmin interface.
- In the left pane of the phpMyAdmin, select the database you want to export.
- Select the ‘Export’ tab at the top.
- Now, you shall see two options i.e. Quick and Custom. You can select Quick if you want to go with default option or select Custom if you want to select particular tables and comepresion type of the exported file in addition to many other options.
Note: The older version of phpMyAdmin does not support Quick. So you’ll have to follow another method for that.
- Now, single out the format you wish to export your database in. Click on the drop-down menu and opt out the one from the given list.
- Confirm your choice by clicking on the ‘Go’ button.
- Now, you will be asked to either open or save the chosen file. You may select save the file and save it to your desired location.
Congratulations!! You have successfully exported the file.
As you can see all the things in phpMyAdmin XAMPP are greatly powerful that gives you the freedom to manage the database efficiently. I tried including all the significant aspects related to phpMyAdmin on XAMPP. However, to cover every single portion and to answer each query I need your help. Yes! You can help me by asking your queries in the comments below and I will do my best to answer them. Whereas, if you wish to learn more about website development and want to create your own website, then you may use TemplateToaster website builder. It will give you a fully functional, mobile-optimized website in no time. Moreover, it doesn’t require you to be technically skilled to run TemplateToaster. So, craft your site and test it on XAMPP or WAMP wherever you like.