码迷,mamicode.com
首页 > 数据库 > 详细

mysql_1

时间:2015-11-07 12:14:20      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

1.mysql> select NOW();等效于select user()\g
+---------------------+
| NOW()               |
+---------------------+
| 2015-11-07 10:29:04 |
+---------------------+
1 row in set (0.00 sec)
mysql> select NOW(),USER(),VERSION();
+---------------------+----------------+-----------------+
| NOW()               | USER()         | VERSION()       |
+---------------------+----------------+-----------------+
| 2015-11-07 10:32:18 | root@localhost | 5.5.35-1ubuntu1 |
+---------------------+----------------+-----------------+
1 row in set (0.00 sec)

mysql> select NOW(),USER(),VERSION()\g
+---------------------+----------------+-----------------+
| NOW()               | USER()         | VERSION()       |
+---------------------+----------------+-----------------+
| 2015-11-07 10:35:37 | root@localhost | 5.5.35-1ubuntu1 |
+---------------------+----------------+-----------------+
1 row in set (0.00 sec)

mysql> select NOW(),USER(),VERSION()\G
*************************** 1. row ***************************
    NOW(): 2015-11-07 10:35:41
   USER(): root@localhost
VERSION(): 5.5.35-1ubuntu1
1 row in set (0.00 sec)
取消
mysql> select user(),
    -> now(),
    -> \c
mysql>

创建数据库

mysql> create database sampdb;
Query OK, 1 row affected (0.02 sec)

mysql> select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)

mysql> use sampdb;   $mysql sampdb -u root -p

$mysql -h hostname -u root -p sampdb

mysql> select database();
Database changed

+------------+
| database() |
+------------+
| sampdb     |
+------------+
1 row in set (0.00 sec)

 

mysql_1

标签:

原文地址:http://www.cnblogs.com/guxuanqing/p/4944763.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!