Some basic MySQL operations

Source: Internet
Author: User

Recently began to learn MySQL, mainly through books, and see Yan 18 teacher's video, and then through the blog to record their learning process.

Log in to Database

View all current databases
Mysql> show databases, #查看当前所有数据库 +--------------------+| Database           |+--------------------+| information_schema | | Ceshi              | | mysql              | | performance_schema |+--------- -----------+4 rows in Set (0.04 sec)
Create a database Ceshi1
mysql> CREATE database ceshi1; #创建数据库ceshi1Query OK, 1 row Affected (0.00 sec) mysql> show databases; #查看当前所有数据库 will see now One more ceshi1+--------------------+|. Database           |+--------------------+| information_schema | | Ceshi              | | ceshi1             | | mysql              | | performance_ Schema |+--------------------+5 rows in Set (0.00 sec)
to view the definition of a database ceshi1
Mysql> Show Create Database ceshi1, #查看数据库ceshi1的定义 +----------+------------------------------------------------- ------------------+| Database | Create Database                                                   |+----------+-------------------------------------------------------------------+| ceshi1   | CREATE DATABASE ' ceshi1 '/*!40100 DEFAULT CHARACTER SET latin1 */|+----------+---------------------------------------- ---------------------------+1 Row in Set (0.00 sec)
Delete Database Ceshi1
mysql> drop database ceshi1; #删除数据库ceshi1Query OK, 0 rows affected (0.07 sec) mysql> show databases; #查看当前所有数据库, you will now find C Eshi1 no longer exists because it has been removed +--------------------+| Database           |+--------------------+| information_schema | | Ceshi              | | mysql              | | performance_schema |+--------- -----------+4 rows in Set (0.00 sec)

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.