Mysql database creation and deletion (base 2)

Source: Internet
Author: User

To create the database syntax:

[email protected]:~$ mysql-uxlong-pqwe123 #使用普通用户登录Mysqlmysql: [Warning] Using a password on the command Li Ne interface can be insecure.  Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 14Server version:5.7.21-0ubuntu0.16.04.1 (Ubuntu) Copyright (c), 2018, Oracle and/o R its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help.    Type ' \c ' to clear the current input statement.mysql> create database mybd1;             #创建一个名为 "MYDB1" database query OK, 1 row Affected (0.00 sec) mysql> Show databases; #查看创建的数据库 "MYDB1" +--------------------+| Database |+--------------------+| Information_schema | | MYBD1 | | MySQL | | Performance_schema | |    SYS |+--------------------+5 rows in Set (0.00 sec) mysql> drop database mybd1; #删除名为 the database "MYDB1", you can also use thisSample syntax Delete database (drop db if exists mydb1;) Query OK, 0 rows Affected (0.00 sec) mysql> Show databases; #查看删除结果, the "MYDB1" database has been deleted +--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | |  SYS |+--------------------+4 rows in Set (0.00 sec) mysql> SELECT DATABASE (); #查看当前在数据库的目录, like the PWD in Linux. +------------+ #这个结果表示, currently just inside the MySQL lobby, has not entered the database. DATABASE () |+------------+|       NULL |+------------+1 row in Set (0.01 sec)

Enter the database:

mysql> CREATE database mydb123;    #创建一个数据库Query OK, 1 row Affected (0.00 sec) mysql> show databases;     #查看创建结果, Mydb123 has created complete +--------------------+| Database           |+--------------------+| information_schema | | mydb123            | | mysql              | | performance_schema | | sys                |+--------------------+5 rows in Set (0.00 sec) mysql> use mydb123;    #进入创建的mydb123 database changedmysql> Select db ();  #查看当前所在数据库目录, the mydb123 database has been entered. +------------+| Database () |+------------+| Mydb123    

  

Mysql database creation and deletion (base 2)

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.