0% found this document useful (0 votes)
24 views1 page

Mysq

The document shows how to access a MySQL database, create a database and table, and view information about the database and table. Commands are provided to log in to MySQL, create a database and table, and view databases, tables and columns.

Uploaded by

Mohamed Yahia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Mysq

The document shows how to access a MySQL database, create a database and table, and view information about the database and table. Commands are provided to log in to MySQL, create a database and table, and view databases, tables and columns.

Uploaded by

Mohamed Yahia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

TO access MySQL:

# mysql -u root -p

- Create Database:

mysql> create database tecmint ;


Query OK, 1 row affected (0.02 sec)
mysql>

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tecmint |
| test |
+--------------------+
9 rows in set (0.00 sec)
mysql>

--Select Database
mysql> use tecmint;
Database changed
mysql>

--Create Tables in MySQL:


mysql> CREATE TABLE minttec (
-> id Int(3),
-> first_name Varchar (15),
-> email Varchar(20)
-> );
Query OK, 0 rows affected (0.08 sec)
mysql>

mysql> show tables;


+-------------------+
| Tables_in_tecmint |
+-------------------+
| minttec |
+-------------------+
1 row in set (0.00 sec)
mysql>

mysql> show columns from minttec;


+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| id | int(3) | YES | | NULL | |
| first_name | varchar(15) | YES | | NULL | |
| email | varchar(20) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql>

You might also like