Mysql Quick Start

Source: Internet
Author: User

After using other databases such as oracle and sybase, when getting started with the mysql database, I usually care about how to know the current database, what tables are in the database, and what table structure is there? How to execute an External SQL file. This article sorts out some mysql Quick Start information based on the SQL data, hoping to help those who want to know other databases and want to transfer them to mysql.
1: display the database
Show databases,
2: currently selected database,
Mysql> select database ();
+ ------------ +
| DATABASE () |
+ ------------ +
| Test |
+ ------------ +
3: Table information contained in the current database:
Mysql> show tables;
+ --------------------- +
| Tables in test |
+ --------------------- +
| Mytable1 |
| Mytable2 |
+ --------------------- +
4. Get the table structure
Mysql> desc mytable1;
+ --------- + ------------- + ------ + ----- + --------- + ------- +
| Field | Type | Null | Key | Default | Extra |
+ --------- + ------------- + ------ + ----- + --------- + ------- +
| S1 | varchar (20) | YES | NULL |
+ --------- + ------------- + ------ + ----- + --------- + ------- +
5. Execute External SQL scripts
Shell> mysql <input. SQL
Run input. SQL on the current database.
Or
Shell> mysql test <input. SQL
Run input. SQL on the test database.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.