标签:may Owner 普通用户 int ted form tor 查看 other
创建数据库 语法:
pyvip@Vip:~$ mysql -uxlong -pqwe123 #使用普通用户登录Mysql mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> create database mybd1; #创建一个名为 "mydb1" 的数据库 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; #删除名为 "mydb1" 的数据库,也可以使用这样语法删除数据库(drop database if exists mydb1;) Query OK, 0 rows affected (0.00 sec) mysql> show databases; #查看删除结果, "mydb1" 数据库已经被删除了 +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> SELECT DATABASE(); #查看当前在数据库的目录,类似linux中的pwd。 +------------+ #这个结果表示,当前只是在mysql大厅里面,还没有进入数据库中。 | DATABASE() | +------------+ | NULL | +------------+ 1 row in set (0.01 sec)
进入数据库:
mysql> create database mydb123; #创建一个数据库 Query OK, 1 row affected (0.00 sec) mysql> show databases; #查看创建结果,mydb123 已经创建完成 +--------------------+ | Database | +--------------------+ | information_schema | | mydb123 | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec) mysql> use mydb123; #进入创建的mydb123 数据库 Database changed mysql> select database(); #查看当前所在数据库目录,已经进入mydb123 数据库。 +------------+ | database() | +------------+ | mydb123 | +------------+ 1 row in set (0.00 sec) mysql>
标签:may Owner 普通用户 int ted form tor 查看 other
原文地址:https://www.cnblogs.com/longxd/p/8831132.html