PHP and MySQL (56 Blogs) Become a Certified Professional

How to Create and Delete a Database in phpMyAdmin

Last updated on Nov 25,2020 36.8K Views


In order to handle the administration of MySQL over the web, phpMyAdmin is a free software tool that is written in PHP. Wide range of operations on MySQL and MariaDB are supported by phpMyAdmin. Various operations like managing databases, tables, columns, relations, indexes, users etc can be performed through its user interface and also can execute any SQL statement. Generally, the database consists of one or more tables. Special CREATE privileges are needed to create or delete a database in phpMyAdmin in the following order:

 

Create a database in phpMyAdmin

Open localhost dashboard and click on phpMyAdmin.

XAAMP-DownLoad

Now create a database either through MySQLi or manually. In order to do it manually, click on databases and create a new one.

Create New Database

You can also change privileges and set up a new user login to access this database by clicking on add user account as shown in the screenshot below

add user account

You can also create a database using MySQLi procedural as shown in the example below:

// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}

// Create database
$sql = "CREATE DATABASE mydatabase";
if (mysqli_query($conn, $sql)) 
{
    echo "Database created successfully";
} else 
{
    echo "Error creating database: " . mysqli_error($conn);
}

mysqli_close($conn);
?>

 

//Output:

Database Created Successfully

 

Delete a database in phpMyAdmin

Go the phpMyAdmin home page and select the database which you want to delete. Now select operations and click on drop the database as shown in the screenshot below.

drop database -in phpMyAdmin

warning - database-in-phpMyAdmin

You can also drop the database using SQL query as shown in the screenshot below:

DROP DATABASE mydatabase;

sql querries

With this, we come to an end of this How to Create and Delete a Database in phpMyAdmin article. I hope you have learned about how to create and delete a database in phpMyAdmin by manually and also by using a query.

Check out the PHP Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. It will give you a good understanding of PHP.

Got a question for us? Please mention it in the comments section of this article and I will get back to you.

Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

How to Create and Delete a Database in phpMyAdmin

edureka.co