mysq帮助命令(help,system)

mysql 数据库的常用命令




system命令

在mysql命令符下,可以执行sql命令:

mysql -u root -p --socket=/home/vpnmysql/mysql/mysql.sock -D testdb3

mysql> 

在mysql命令符下有时候突然想执行下shell的命令,比如查看当前路径有那些文件,就可以使用system命令了,相当于从mysql命令符临时切换到了操作系统了,可以执行shell命令了,个人感觉这个命令挺有用的~

mysql> system shell command

mysql>  system ls;
test1.sh


help contents 命令

如果新手刚接触mysql,一个命令也不知道,mysql也提供方法可以查看的:

mysql> mysql testcc;#testcc是个不存在的错误命令

Nothing found
Please try to run 'help contents' for a list of all accessible topics

输入错误的命令,提示找不到,并且告诉可以使用'help contents'命令


mysql> help contents;
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
   Account Management
   Administration
   Compound Statements
   Data Definition
   Data Manipulation
   Data Types
   Functions
   Functions and Modifiers for Use with GROUP BY
   Geographic Features
   Help Metadata
   Language Structure
   Plugins
   Procedures
   Storage Engines
   Table Maintenance
   Transactions
   User-Defined Functions
   Utility

mysql全部命令的总目录都列出来了,想学习命令都可以通过这个目录进一步查看和学习了,比如账号管理方面的

mysql> help Account Management
You asked for help about help category: "Account Management"
For more information, type 'help <item>', where <item> is one of the following
topics:
   ALTER USER
   CREATE USER
   DROP USER
   GRANT
   RENAME USER
   REVOKE
   SET PASSWORD

列出这个目录下的全部命令,现在想查看哪个命令,继续查看帮助就可以了,如下

mysql> help  ALTER USER; 
Name: 'ALTER USER'
Description:
Syntax:
ALTER USER user_specification
    [, user_specification] ...


user_specification:
    user PASSWORD EXPIRE


The ALTER USER statement alters MySQL accounts. To use it, you must
have the global CREATE USER privilege or the INSERT privilege for the
mysql database. This statement was added in MySQL 5.6.6.


For each account, ALTER USER expires its password. For example:


ALTER USER 'jeffrey'@'localhost' PASSWORD EXPIRE;


The account name uses the format described in
http://dev.mysql.com/doc/refman/5.6/en/account-names.html. If you
specify only the user name part of the account name, a host name part
of '%' is used.
。。。。。。。

ALTER USER的使用方法和具体例子都列出来了,不管新手还是老手,这都是一个好方法,再好的记忆力,有时候也会忘的,知道了这个方法,随时可以查看了。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值