首页 > 代码库 > ubuntu命令行操作mysql常用操作
ubuntu命令行操作mysql常用操作
- 登陆mysql
harvey@harvey-Virtual-Machine:~/ruby/mydiary$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.
- 查看所有的数据库
mysql> show databases; --注意必须要用;结尾否则不会立即执行代码 +--------------------+ | Database | +--------------------+ | information_schema | | mydiary | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.00 sec)
- 切换数据库,并显示所有的表
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)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。