Login and check the Database created in the First Post on MySQL -1
mysql>
- Go to the MySQL Workbench and find the mysql.exe
- Login to the MySQL using the below command in the command prompt
C:\Program Files
(x86)\MySQL\MySQL Workbench CE 5.2.42>mysql.exe -u root -p
Enter password: ****
Welcome to the MySQL
monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.27 MySQL
Community Server (GPL)
Copyright (c) 2000, 2011,
Oracle and/or its affiliates. All rights reserved.
Oracle is a registered
trademark of Oracle Corporation and/or its
affiliates. Other names may be
trademarks of their respective
owners.
Type 'help;' or '\h' for help.
Type '\c' to clear the current input statement.
- Now we can list the default Databases using the command,
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| world |
+--------------------+
5 rows in set (0.00 sec)
- To use a Database and list the tables in the Database use the below commands,
mysql> USE test;
Database changed
mysql> SHOW tables;
Empty set (0.00 sec)
mysql> USE world;
Database changed
mysql> SHOW tables;
+-----------------+
| Tables_in_world |
+-----------------+
| city |
| country |
| countrylanguage |
+-----------------+
3 rows in set (0.00 sec)
mysql> DESCRIBE city;
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| ID | int(11) | NO
| PRI | NULL | auto_increment |
| Name | char(35) | NO |
| | |
| CountryCode | char(3) | NO
| | | |
| District | char(20) | NO |
| | |
| Population | int(11)
| NO | | 0
| |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.03 sec)
- Creating a Database ,table and changing the Storage engine of the created database.
mysql> create database sri;
Query OK, 1 row affected (0.01
sec)
mysql> USE sri;
Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sri |
| test |
| world |
+--------------------+
6 rows in set (0.00 sec)
mysql> create table test
(name varchar(20),age number);
ERROR 1064 (42000): You have an
error in your SQL syntax; check
r)' at line 1
mysql> create table test
(name varchar(20),age int);
Query OK, 0 rows affected (0.01
sec)
mysql> show tables;
+---------------+
| Tables_in_sri |
+---------------+
| test |
+---------------+
1 row in set (0.00 sec)
mysql>
mysql> describe test;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | |
NULL | |
| age | int(11)
| YES | | NULL
| |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> alter table test
ENGINE = InnoDB;
Query OK, 0 rows affected (0.01
sec)
Records: 0 Duplicates: 0
Warnings: 0
- To View the available Plugins and engines,
mysql> show plugins;
+-----------------------+----------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+-----------------------+----------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| mysql_native_password |
ACTIVE | AUTHENTICATION | NULL
| GPL |
| mysql_old_password | ACTIVE
| AUTHENTICATION | NULL | GPL
|
| CSV | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| FEDERATED | DISABLED | STORAGE ENGINE |
NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL
| GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL
|
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL
|
| INNODB_LOCK_WAITS | ACTIVE
| INFORMATION SCHEMA | NULL |
GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL
|
| INNODB_CMP_RESET | ACTIVE
| INFORMATION SCHEMA | NULL |
GPL |
| INNODB_CMPMEM | ACTIVE
| INFORMATION SCHEMA | NULL |
GPL |
| INNODB_CMPMEM_RESET | ACTIVE
| INFORMATION SCHEMA | NULL |
GPL |
| PERFORMANCE_SCHEMA | ACTIVE
| STORAGE ENGINE | NULL | GPL
|
| partition | ACTIVE | STORAGE ENGINE | NULL
| GPL |
+-----------------------+----------+--------------------+---------+---------+
20 rows in set (0.04 sec)
In the next post will see on the structures ...
No comments:
Post a Comment