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. UniController provides a convenient menu option described below. 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

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

Delete Database

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

Note: Clear entry and selection (4) clears the database name (1) and any database selected (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).

  • If not at the home page, click Home icon (1).
  • From the top menu bar, select Databases (2).
  • Enter name of database to create; for example, wordpress (3).
  • Optionally, select a collation from the dropdown (4). No selection: default is used.
  • Click Create button (5); a created confirmation is displayed.
  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).

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

Create / Delete Database using Server Console

Start the MySQL server and open a command window by clicking 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 root (-proot) with your password in the above.

Related topics

How to run a standard Server Console command window
MySQL Console command window short cut


--oOo--