Zero logo

MySQL Create delete Database

There are three methods for creating or deleting a database; you can use UniController, phpMyAdmin, or Server Command Console. UniTray provides a convenient menu option described bellow. To use this option ensure the MySQL server is running otherwise the button remains greyed out.

Create Delete Database using UniController

MySQL > Database create-delete

Create Database

  • 1) Enter a database name, e.g mydb
  • 2 Click the "Create Database" button

Delete Database

  • 3) Select a database to delete
  • 5) Click the "Delete Database" button

Note 1:
4) Clear entry and selection.
Deletes the name entered in 1) and any database selected in 3).

Create delete Database

Create Delete Database using phpMyAdmin

Start Controller and click phpMyAmin button. To create or delete a database proceed as follows:

Create Database

When first started, the phpMyAdmin home page is displayed. You can always return to this page by clicking the home icon (1)

  • 1) If not at the home page, click home icon
  • 2) From the top menu bar select Databases
  • 3) Enter name of database to create; for example, "wordpress"
  • 4) Optionally select a collation from the dropdown. No selection default is used (see note).
  • 5) Click Create button, a created confirmation is displayed.
Note: On the home page the default collection is set to utf8_general_ci
Create delete Database phpMyAdmin

Delete Database

When first started, the phpMyAdmin home page is displayed. You can always return to this page by clicking the home icon (1)

  • 1) If not at the home page, click home icon
  • 2) From top menu bar select Databases
  • 3) Select database to delete (drop); for example, "wordpress"
  • 4) Click Drop button; an alert box is displayed.
  • 5) Click Yes on alert box "You are about to DESTROY a complete database!"
  • 6) A confirmation is displayed "1 databases have been dropped successfully."
Create delete Database phpMyAdmin

Create Delete Database using Server Console

Start the MySQL server, now open a command window by clciking the Server Console button. You can use either of the MySQL utilities, Client or Admin, to create and delete a database as follows:

MySQL utility - mysqladmin

Create a database

To create a database named joomla, enter the following command into the window:

  • mysqladmin.exe --host=127.0.0.1 --user=root --password=root create joomla

Delete a database

To delete a database named joomla, enter the following command into the window:

  • mysqladmin.exe --host=127.0.0.1 --user=root --password=root --force drop joomla

Note: You can specify the MySQL port to use:

  • mysqladmin.exe --host=127.0.0.1 --port=3306 --user=root --password=root create joomla
  • mysqladmin.exe --host=127.0.0.1 --port=3306 --user=root --password=root --force drop joomla

MySQL utility - mysql Client

Note: Although the following uses the "Server Console" you can as an alternative use the MySQL Console
this saves having to type the first line (mysql -h127.0.0.1 -uroot -proot)

Create a database

To create a database named wordpress, enter the following commands into the window:
  • mysql -h127.0.0.1 -uroot -proot
  • At the mysql prompt type: CREATE DATABASE wordpress;
  • At the mysql prompt type: exit

C:\UniServerZ\core\mysql\bin>mysql -h127.0.0.1 -uroot -proot

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.03 sec)

mysql> exit
Bye

Delete a database

To delete a database named wordpress, enter the following commands into the window:
  • mysql -h127.0.0.1 -uroot -proot
  • At the mysql prompt type: DROP DATABASE wordpress;
  • At the mysql prompt type: exit

C:\UniServerZ\core\mysql\bin>mysql -h127.0.0.1 -uroot -proot

mysql> DROP DATABASE wordpress;
Query OK, 0 rows affected (0.17 sec)

mysql> exit
Bye

Note: If you have changed the MySQL root password, remember to substitute (-proot) root with your password in the above.

Related topics

MySQL Prompt
How to run a standard command window
MySQL prompt command window short cut