前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql基础语句

mysql基础语句

作者头像
零月
发布2018-04-25 16:08:36
3.1K0
发布2018-04-25 16:08:36
举报
文章被收录于专栏:从零开始的linux从零开始的linux

show命令

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

创建数据库

mysql> create database `ha-test`;

Query OK, 1 row affected (0.01 sec)

查看数据库具体位置

mysql> select database();

+------------+

| database() |

+------------+

| ha-test |

+------------+

在终端查看数据库

# mysqlshow -uroot -p123456

Warning: Using a password on the command line interface can be insecure.

+--------------------+

| Databases |

+--------------------+

| information_schema |

| ha-test |

| mysql |

| performance_schema |

+--------------------+

# mysql -e 'show databases' -uroot -p123456

Warning: Using a password on the command line interface can be insecure.

+--------------------+

| Database |

+--------------------+

| information_schema |

| ha-test |

| mysql |

| performance_schema |

+--------------------+

查看时间

mysql> select now(),user(),database();

+---------------------+----------------+------------+

| now() | user() | database() |

+---------------------+----------------+------------+

| 2017-06-26 20:50:51 | root@localhost | ha-test |

+---------------------+----------------+------------+

1 row in set (0.00 sec)

删除数据库

mysql> drop database `ha-test`;

Query OK, 0 rows affected (0.00 sec)

mysql> select now(),user(),database();

+---------------------+----------------+------------+

| now() | user() | database() |

+---------------------+----------------+------------+

| 2017-06-26 20:55:46 | root@localhost | NULL |

+---------------------+----------------+------------+

1 row in set (0.00 sec)

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-06-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档