Some basic MySQL operations

Source: Internet
Author: User

I recently started to learn MySQL, mainly through books and videos from instructor Yan 18, and then recorded my learning process through blogs.

Log on to the database

zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pEnter password: 
View all current databases
Mysql> show databases; # view all current databases + -------------------- + | Database | + -------------------- + | information_schema | ceshi | mysql | performance_schema | + -------------------- + 4 rows in set (0.04 sec)
Create Database ceshi1
Mysql> create database ceshi1; # create a database ceshi1Query OK, 1 row affected (0.00 sec) mysql> show databases; # view all current databases, A ceshi1 + -------------------- + | Database | + -------------------- + | information_schema | ceshi | ceshi1 | mysql | performance_schema | + rows + 5 rows in set (0.00 sec)
View database ceshi1 Definitions
Mysql> show create database ceshi1; # view the definition of the Database ceshi1 + ---------- + certificate + | Database | Create DATABASE | + ---------- + certificate + | ceshi1 | CREATE database 'ceshi1 '/*! 40100 default character set latin1 */| + ---------- + ----------------------------------------------------------------- + 1 row in set (0.00 sec)
Delete database ceshi1
Mysql> drop database ceshi1; # Delete the database ceshi1Query OK, 0 rows affected (0.07 sec) mysql> show databases; # view all current databases, and now you will find that ceshi1 does not exist, because it has been deleted + ------------------ + | 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.