Perintah Dasar Mysql

No Comments


Login Mysql :
C:\xampp\mysql\bin>mysql -u root
Membuat Database:
mysql> CREATE DATABASE akademik_1049;
Menghapus Database:
mysql> DROP DATABASE akademik_1049;
Menggunakan Databases :
mysql> USE DATABASE akademik_1049;
Membuat Table;
mysql> CREATE TABLE mahasiswa(
-> Nim CHAR (10),
-> Nama_mhs VARCHAR (50),
-> Alamat_mhs VARCHAR (100));
Melihat Properti Tables Yang Kita Buat:
mysql> desc mahasiswa;
Merubah Nama Tabel :
mysql> ALTER TABLE mahasiswa RENAME Siswa;
Merubah properti Tabel:
mysql> alter table mahasiswa change nim2 Nim varchar(15);
Menghapus Kolom Table :
mysql> Alter table mahasiswa drop Nama_ortu;
Memasukkan data ke table :
mysql> INSERT INTO mahasiswa values('06.11.1049','Gojack','Pucung,Planjan');
MengUpdate Isi Tabel :
mysql> UPDATE mahasiswa set nama_mhs='dita' where alamat_mhs='06.11.1049';
Menghapus Isi Tabel :
mysql> DELETE FROM mahasiswa where Nim='06.11.1049';
Melihat Tabel :
mysql>SELECT * FROM mahasiswa;
Back up database :
C:\xampp\mysql\bin>mysqldump -u root properti_1049 > d:\campus\dita.sql
Restore Database :
C:\xampp\mysql\bin>mysql -u root properti_1049

Dear readers, after reading the Content please ask for advice and to provide constructive feedback Please Write Relevant Comment with Polite Language.Your comments inspired me to continue blogging. Your opinion much more valuable to me. Thank you.