Before we start creating a project on PHP and MySQL, you must first create a database because the database is needed in the project later. Well we are going to create a database using mysql xampp. Here I will explain how to create a mysql database with a command prompt (CMD) and through phpMyAdmin Tool is a tool that comes from xampp.

Well, we'll start now by using the command prompt and Tool phpMyAdmin.


1.        Using phpMyAdmin Tool


-          First we install XAMPP in advance, if you do not have a program and how to run XAMPP XAMMP then you can read the tutorial I have made XAMPP
-          Once XAMPP is installed, it will open the browser Mozilla firefox or google chrome to open a page in the address bar http://localhost/phpmyadmin
-          Then it will come out the page as shown below
-          If we want to create a database, then type the name of the database on the "create new database" after we type the name of the database click create to create the database.
-          Congratulations, you managed to create a database 





2.        Creating a database with a command prompt
  - First we open a command prompt in the following manner: (Start + All Programs + Accessories + Command Prompt) or by using the keyboard: (flag + R, type in the name of "CMD", Enter).
  -   Once the command prompt window appear, type the following command to start the database creation :
cd "C: \ Program Files \ xampp \ mysql \ bin" <enter>
  -    Once enter the command would look like this cd "C: \ Program Files \ xampp \ mysql \ bin" then retype the command mysql-u root-p if you type the command was correct, then it would look like the following command works
"Welcome to the MySQL Monitor"
-          If successful, we will begin to create a database with the following command:
mysql> create database dame;
if there is a command below, it is because the database already exists.
ERROR 1007 (HY000): Can not create database 'dame'; database exists
So, how to remove database "dame" with the following command:
mysql> DROP database dame;
Query OK, 0 rows affected (0.06 sec)
Once we remove the database, then we return to our discussion of creating a database with the command :
mysql> create database dame;
Query OK, 1 row affected (0.00 sec)
It worked, we managed to create a database that will be used later
-          if we want to see the database that we created earlier, just with the command: show databases; then it will come out all existing databases on phpmyadmin that we created earlier

If you want to create a table from the database we have designed earlier, can follow the following ways:

-          Go back to step-langah earlier, if it is entered into the mysql type the following command:
mysql> show databases;
will be seen all there is to the mysql database.
-          After that, type the command:
mysql> use database dame;
This dame is to use an existing database in mysql.
-          Then we will begin to make a table with the following command:
mysql> create table first (
-> No int (4) not null auto_increment,
-> Name varchar (100) not null,
-> Address varchar (100) not null,
-> JK enum ('P', 'L'),
-> Job varchar (100) not null
->);
-          Then it will successfully create a database table for a dame.

Only that I can share with you all, if this tutorial for you all I am very thankful I have used writing.

0 komentar:

Post a Comment

if you have any questions about posting, feel free to comment.
thank you