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

ubuntu命令行操作mysql常用操作

时间:2014-05-07 20:06:47      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   tar   

  1. 登陆mysql
    bubuko.com,布布扣
    harvey@harvey-Virtual-Machine:~/ruby/mydiary$ mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    bubuko.com,布布扣
  2. 查看所有的数据库
    bubuko.com,布布扣
    mysql> show databases; --注意必须要用;结尾否则不会立即执行代码
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mydiary            |
    | mysql              |
    | performance_schema |
    +--------------------+
    4 rows in set (0.00 sec)
    bubuko.com,布布扣
  3. 切换数据库,并显示所有的表
    bubuko.com,布布扣
    mysql> use mysql #mysql是数据库自带的
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> show tables
        -> ;
    +---------------------------+
    | Tables_in_mysql           |
    +---------------------------+
    | columns_priv              |
    | db                        |
    | event                     |
    | func                      |
    | general_log               |
    | help_category             |
    | help_keyword              |
    | help_relation             |
    | help_topic                |
    | host                      |
    | ndb_binlog_index          |
    | plugin                    |
    | proc                      |
    | procs_priv                |
    | proxies_priv              |
    | servers                   |
    | slow_log                  |
    | tables_priv               |
    | time_zone                 |
    | time_zone_leap_second     |
    | time_zone_name            |
    | time_zone_transition      |
    | time_zone_transition_type |
    | user                      | #这里是mysql的所有用户
    +---------------------------+
    24 rows in set (0.00 sec)
    bubuko.com,布布扣

ubuntu命令行操作mysql常用操作,布布扣,bubuko.com

ubuntu命令行操作mysql常用操作

标签:style   blog   class   code   java   tar   

原文地址:http://www.cnblogs.com/zhanghaiyublog/p/3709745.html

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