Mysql quick start _ MySQL

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? This article describes how to execute an external SQL file. based on the SQL data, we sorted out some information about mysql quick start, users who want to learn about other databases and want to transfer them to mysql will be concerned about how to know the current database when getting started with mysql databases after using other databases such as oracle and sybase, what tables are in the database and what is the table structure? 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.

[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]

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.