• log into the mysql
for localhost
mysql -u username -ppasswd(there is no space)
for ip
mysql -h ip -P port -u username -ppasswd(there is no space,-P default 3306)
  • show operators
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db_followtrade |
| db_user_msg |
| mysql |
| performance_schema |
| user |
+--------------------+
6 rows in set (0.00 sec) use user; mysql> show tables;
+----------------+
| Tables_in_user |
+----------------+
| t_user |
+----------------+
1 row in set (0.00 sec)
  • others show operator
mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+-------+------------------+
| 42 | root | localhost | user | Query | 0 | init | show processlist |
+----+------+-----------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)
mysql> show global variables like "%datadir%";
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| datadir | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec) mysql> show global variables like "%cache%";
+--------------------------------+----------------------+
| Variable_name | Value |
+--------------------------------+----------------------+
| binlog_cache_size | 32768 |
| binlog_stmt_cache_size | 32768 |
| have_query_cache | YES |
| host_cache_size | 279 |
| innodb_disable_sort_file_cache | OFF |
| innodb_ft_cache_size | 8000000 |
| innodb_ft_result_cache_limit | 2000000000 |
| innodb_ft_total_cache_size | 640000000 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| max_binlog_cache_size | 18446744073709547520 |
| max_binlog_stmt_cache_size | 18446744073709547520 |
| metadata_locks_cache_size | 1024 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | OFF |
| query_cache_wlock_invalidate | OFF |
| stored_program_cache | 256 |
| table_definition_cache | 1400 |
| table_open_cache | 2000 |
| table_open_cache_instances | 1 |
| thread_cache_size | 8 |
+--------------------------------+----------------------+
24 rows in set (0.01 sec)
show character set;
show collation;
mysql> show create database db_user_msg ;
+-------------+------------------------------------------------------------------------+
| Database | Create Database |
+-------------+------------------------------------------------------------------------+
| db_user_msg | CREATE DATABASE `db_user_msg` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+-------------+------------------------------------------------------------------------+
1 row in set (0.00 sec) mysql> show tables;
+-----------------------+
| Tables_in_db_user_msg |
+-----------------------+
| t_manage_user |
| t_send_log |
| t_user |
+-----------------------+
3 rows in set (0.00 sec) mysql> show create table t_manage_user\G
*************************** 1. row ***************************
Table: t_manage_user
Create Table: CREATE TABLE `t_manage_user` (
`name` varchar(20) DEFAULT NULL,
`wx_id` varchar(20) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`email` varchar(20) DEFAULT NULL,
`status` tinyint(1) DEFAULT NULL,
`role` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.01 sec)
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
mysql> show grants;
mysql> show grants for current_user;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
show index from one_table_name;
mysql> show privileges;
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege | Context | Comment |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter | Tables | To alter the table |
| Alter routine | Functions,Procedures | To alter or drop stored functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables |
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE |
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE |
| Create view | Tables | To create new views |
| Create user | Server Admin | To create new users |
| Delete | Tables | To delete existing rows |
| Drop | Databases,Tables | To drop databases, tables, and views |
| Event | Server Admin | To create, alter, drop and execute events |
| Execute | Functions,Procedures | To execute stored routines |
| File | File access on server | To read and write files on the server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess |
| Index | Tables | To create or drop indexes |
| Insert | Tables | To insert data into tables |
| Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain text of currently executing queries |
| Proxy | Server Admin | To make proxy user possible |
| References | Databases,Tables | To have references on tables |
| Reload | Server Admin | To reload or refresh tables, logs and privileges |
| Replication client | Server Admin | To ask where the slave or master servers are |
| Replication slave | Server Admin | To read binary log events from the master |
| Select | Tables | To retrieve rows from table |
| Show databases | Server Admin | To see all databases with SHOW DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW |
| Shutdown | Server Admin | To shut down the server |
| Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers |
| Create tablespace | Server Admin | To create/alter/drop tablespaces |
| Update | Tables | To update existing rows |
| Usage | Server Admin | No privileges - allow connect only |
+-------------------------+---------------------------------------+-------------------------------------------------------+
show status;
show triggers;

MySQL经常使用命令--show命令使用的更多相关文章

  1. ubuntu linux mysql 安装 基本操作 命令

    mysql --help #如果有信息证明系统已经安装了mysql mysql -V #查看版本号 netstat -tap|grep mysql #检查mysql是否在启动状态 卸载mysql: s ...

  2. MySQL启动和关闭服务命令

    MySQL启动和关闭服务命令 1.启动服务命令 net start mysql 2.关闭服务命令 net stop mysql

  3. MySQL中的binlog相关命令和恢复技巧

    操作命令: 复制代码 代码如下: show binlog events in 'mysql-bin.000016' limit 10; reset master 删除所有的二进制日志 flush lo ...

  4. MySql命令行命令和SQL语句

    一.常用mysql命令行命令 1.启动MYSQL服务 net start mysql 停止MYSQL服务 net stop mysql 2.netstat -na|findstr 3306 查看被监听 ...

  5. MySQl数据库常用的DOS命令

    MySQl数据库常用的DOS命令.. 这是第一部分.. 数据库的连接信息:jdbc:mysql://localhost:3306/shxtcom.mysql.jdbc.Driver /*jdbc:sq ...

  6. Mysql 远程登录及常用命令

    第一招.mysql服务的启动和停止 net stop mysql net start mysql 第二招.登陆mysql 语法如下: mysql -u用户名 -p用户密码 键入命令mysql -uro ...

  7. [svc]mysql备份恢复及常用命令

    如何实现mysql读写分离 1.通过程序实现读写分类(性能 效率最佳) php和java都可以通过设置多个连接文件轻松实现对db的读写分离,即当select时,就去连读库的连接文件,当update,i ...

  8. mysql常用反斜杠命令

    mysql常用反斜杠命令 https://dev.mysql.com/doc/refman/5.7/en/mysql-commands.html https://dev.mysql.com/doc/r ...

  9. MySQL锁定状态查看相关命令

    1.show processlist; SHOW PROCESSLIST显示哪些线程正在运行.您也可以使用mysqladmin processlist语句得到此信息.如果您有SUPER权限,您可以看到 ...

  10. 下厨房6月26日数据丢失事故总结 MYSQL主分区被rm 命令误删除

    下厨房6月26日数据丢失事故总结 MYSQL主分区被rm 命令误删除 http://tech.xiachufang.com/?p=18 在6月26日凌晨12点左右,我们在做线上数据库的备库时,误将线上 ...

随机推荐

  1. vmware 14黑屏处理办法

    从12升级到了14,但是发现所有的虚拟机都不能用了,黑屏.挂起的时候反而会显示界面,但是继续运行就是黑屏. 记录下解决办法. 修复LSP 以管理员身份运行CMD命令: netsh winsock re ...

  2. (转)Vue 爬坑之路(一)—— 使用 vue-cli 搭建项目

    vue-cli 是一个官方发布 vue.js 项目脚手架,使用 vue-cli 可以快速创建 vue 项目,GitHub地址是:https://github.com/vuejs/vue-cli 一. ...

  3. Hadoop学习笔记(一)Hadoop的单节点安装

    要想深入学习Hadoop分布式文件系统,首先需要搭建Hadoop的实验环境,Hadoop有两种安装模式,即单节点集群模式安装(也称为伪分布式)和完全分布式模式安装,本节只介绍单节点模式的安装,参考官方 ...

  4. 查看 Android App 的 versionCode

    有 App 源码时,可以直接查看 AndroidManifest.xml 文件. <manifest android:versionName="1.4" android:ve ...

  5. hibernate_05_单表操作_对象类型

    本篇使用hibernate输出一个对象(图片) 先写一个java类 package com.imooc.hibernate; import java.sql.Blob; import java.uti ...

  6. vegas pro 15解决导入的视频和音频有噪声问题,亲测可行

    中文步骤: 按住Shift->点击选项->首选项,松开Shift 点击右上角"内部"选项卡,在最下面的搜索栏输入SO4 找到第二项Enable So4 Compound ...

  7. java中负数的补码转换为十进制

    一个数如果为正,则它的原码.反码.补码相同:一个正数的补码,将其转化为十进制,可以直接转换. 已知一个负数的补码,将其转换为十进制数,步骤: 1.先对各位取反: 2.将其转换为十进制数: 3.加上负号 ...

  8. 【sqli-labs】 less15 POST - Blind- Boolian/time Based - Single quotes (基于bool/时间的单引号POST型盲注)

    错误不回显了 构造永真登陆 登陆成功了 虽然登陆成功了,但是数据库的数据还么有爆出来 构造一下用户名 ' or length(database())=8# 如果数据库名的长度不等于8,登陆会失败 猜测 ...

  9. 在 Laravel 应用中使用 pjax 进行页面加速

    说明# PHPHub 使用 pjax 来加速网页的加载, 这篇文章是在开发完此功能后做的笔记. 什么是 Pjax# .--. / \ ## a a ( '._) |'-- | _.\___/_ ___ ...

  10. loadrunner安装方法

    1.loadrunner安装网盘地址:  http://pan.baidu.com/s/1hrP6mDQ 一般会提示:“vc2005_sp1_with_atl_fix_redist 2.确认时提示缺少 ...