《MySQL》SQL数据导入/导出

  1. SQL数据导入/导出
     问题
    使用SQL语句完成下列导出、导入操作:
  1. 将/etc/passwd文件导入userdb库userlist表并给每条记录加编号

  2. 将userdb库userlist表中UID小于100的前10条记录导出,存为/dbak/ulist.txt文件
     步骤
    实现此案例需要按照如下步骤进行。
    步骤一:将/etc/passwd文件导入MySQL数据库
    导入后的表结构取决于/etc/passwd配置文件。若一时记不住各字段的含义,也可以查看passwd配置文件的man手册页,找到格式描述相关的说明,比如:
    [root@dbsvr1 ~]# man 5 passwd
    … …
    There is one entry per line, and each line has the format:

          account:password:UID:GID:GECOS:directory:shell
    											//各字段的顺序、大致用途
    

The field descriptions are: //以下详细解释各字段的作用

          account   the name of the user on the  system.   It  should  not
                    contain capital letters.

          password  the  encrypted  user password, an asterisk (*), or the
                    letter 'x'.  (See  pwconv(8)  for  an  explanation  of
                    'x'.)

          UID       the numerical user ID.

          GID       the numerical primary group ID for this user.

          GECOS     This field is optional and only used for informational
                    purposes.  Usually, it  contains  the  full  username.
                    GECOS  means  General Electric Comprehensive Operating
                    System, which has been renamed to GCOS when GE’s large
                    systems   division  was  sold  to  Honeywell.   Dennis
                    Ritchie has reported: "Sometimes we sent printer  out-
                    put or batch jobs to the GCOS machine.  The gcos field
                    in the password file was a place to stash the informa-
                    tion for the $IDENTcard.  Not elegant."

          directory the user’s $HOME directory.

          shell     the  program  to run at login (if empty, use /bin/sh).
                    If set to a non-existing executable, the user will  be
                    unable to login through login(1).
                    put or batch jobs to the GCOS machine.  The gcos field
                    in the password file was a place to stash the informa-
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值