MySQL相关信息(二)

1、修改MySQL提示符

(1)连接客户端时通过参数指定

shell>mysql -u root -p --prompt  提示符

C:\Users\Administrator>mysql -u root -p --prompt \h
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.54 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

localhost

(2)连接上客户端后,通过prompt命令修改

mysql>prompt  提示符

localhostprompt mysql>
PROMPT set to 'mysql>'
mysql>

MySQL相关信息(二)

mysql>prompt \u@\h \d>  #用户名@服务器名称 当前数据库
PROMPT set to '\u@\h \d>'
root@localhost (none)>

root@localhost (none)>USE test;
Database changed
root@localhost test>

2、MySQL常用命令

(1)显示当前服务器版本

root@localhost test>SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.5.54 |
+-----------+
1 row in set (0.00 sec)

(2)显示当前日期时间

root@localhost test>SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2017-03-15 15:55:37 |
+---------------------+
1 row in set (0.00 sec)

(3)显示当前用户

root@localhost test>SELECT USER();
+----------------+
| USER() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

root@localhost test>

3、MySQL语句的规范

(1)关键字与函数名字全部大写

(2)数据库名称、标表名称、字段名称全部小写

(3)SQL语句必须以分号结尾

上一篇:苹果App Store开发者帐户从申请,验证,到发布应用(2)


下一篇:go微服务框架go-micro深度学习(三) Registry服务的注册和发现