BuycPanel Blog

BuycPanel Blog

Latest news and updates

5/01/2015 – Create a MySQL Database Manually

Posted by Jamison on 01 05 2015.

Having a database to store, organize and access large amounts of data is very essential, especially for complex websites like e-commerce. Contrary to a simple table of records, a modern database allows more flexibility, helps avoid repetition of data, and enforce other rules that define its functions.

 

mysql-databaseTo date, the most commonly used database technology is MySQL – an open-source engine that can work on major development platforms like Solaris, Windows, OS X, Linux and FreeBSD. A basic version is open for everyone to download, but several paid editions that offer additional features are also available for proprietary use.

 

Creating a useful MySQL database manually can be a daunting task, especially for beginners. It involves hard coding using the Command Prompt, and the lack of visual reference can make the whole process more intimidating. Given this, basic knowledge in manual database creation and manipulation can save one a lot of time and effort.

 

Follow these basic steps to get started with a useful database for various purposes.

 

  1. Start by opening a MySQL command line (mysql> |) using the Command Prompt. To ensure that you’re not creating a database that already exists, show a list of existing databases by typing SHOW, followed by a semicolon. It is worth noting that there’s no letter case syntax, and MySQL cannot determine if letters are in lower or upper case. The semicolon is a delimiter used to end all commands.

 

  1. Create your first database by typing CREATE DATABASE myfirstdb;. Once created, type USE myfirstdb; to execute succeeding commands.

 

  1. Since tables are the most useful feature of a database, you can create tables using the CREATE TABLE If, for example, your website has multiple suppliers, you need to create individual tables per supplier and supplier’s product by typing CREATE TABLE / PRODUCT (name of supplier / product). MySQL auto generates an ID per item.

 

Also, since this would be a lot of information to input, it would be more convenient to type first on a Notepad. Just copy and paste the text into the Command Prompt when you’re ready to execute.

 

If you have erroneously entered a table, use the DROP command to delete it by typing DROP (name of table). However, always be careful when using this command as it can irreversibly wipe out a table having countless records instantly and without warning.

 

  1. Once your tables are ready, you can now input information such as supplier contact details into the cells. These values should be enclosed in single quotation marks as in the syntax: INSERT INTO suppliers (Supplier Name, Email) VALUE (‘Supplier1’ , ’supplier@supplier.com’).

 

A MySQL database is designed to handle large data quantities, so you need not worry about the number of items to input. You can create as many tables as you want, but just make sure that everything has a unique name and value.

 

As you build your interest in developing database applications, MySQL can be your reliable partner as it is powerful, customizable and secure. With relatively simple SQL commands, you can develop a functional database to store all information relevant to your website.