Coral: mysql create delete database

From The Uniform Server Wiki
Jump to navigation Jump to search

MySQL Create delete Database

There are three methods for creating or deleting a database; you can use a command window, phpMyAdmin or UniController. UniController provides a convenient menu option described bellow. To use this option ensure the MySQL server is running otherwise a warning message is produced.


UniServer 8-Coral
  Home
  Quick Start
  General
  Apache
» MySQL
  PHP
  MSMTP
  CRON
  DtDNS
  Db Backup
  Perl
  Main Index

Create Delete Database using UniController

Server Configuration > MySQL > Create delete Database

Create Database

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

Delete Database

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

Note 1: Clear both (4) deletes entered name and database selected.

Top

Create Delete Database using phpMyAdmin

Start UniController 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

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."

Top

Create Delete Database using command window

Click MySQL console, which opens a command window. You can use either of the MySQL utilities, Client or Admin, to create and delete a database as follows:

Command window - mysqladmin

Create a database

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

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

Delete a database

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

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

Note: You can specify the MySQL port to use:

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

Command window - mysql Client

Create a database

To create a database named wordpress, enter the following commands into the window:

  • mysql -uroot -proot
  • At the mysql prompt type: CREATE DATABASE wordpress;
  • At the mysql prompt type: exit
C:\UniServer\usr\local\mysql\bin>mysql -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 -uroot -proot
  • At the mysql prompt type: DROP DATABASE wordpress;
  • At the mysql prompt type: exit
C:\UniServer\usr\local\mysql\bin>mysql -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.

Top

Related topics

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


Top