• 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;

最新文章

  1. C#内存管理与垃圾回收
  2. EasyUI datagrid 行编辑
  3. 对于一些Http远程连接Api安全的看法;
  4. Java--剑指offer(1)
  5. MATLAB中的结构数组
  6. 130+ essential vim commands
  7. android-继承BaseAdapter--自定义适配器,getView执行多次的解决方法
  8. CCNP-3.vlan间路由及三层交换机的配置
  9. Gradle 1.12用户指南翻译——第四十一章. 项目报告插件
  10. 获取url参数值(可解码中文值)
  11. java 静态代理模式
  12. Integer与String的知试点(java中常见面试题)
  13. myeclipse2018安装教程(附下载地址)
  14. Linux C 实现一个简单的线程池
  15. item 23: 理解std::move和std::forward
  16. group_concat的使用
  17. golang解析json配置文件
  18. Jmeter(四)NO-GUI模式运行
  19. Cause: java.sql.SQLException: The user specified as a definer ('root'@'%') does not exist
  20. 20155229《网络对抗技术》Exp9:Web安全基础

热门文章

  1. 79.员工薪水报表 Extjs 页面
  2. bzoj 3172 单词
  3. 2015 多校赛 第五场 1006 (hdu 5348)
  4. wcf 错误:无法加载或初始化请求的服务提供程序
  5. 可变长度参数列表(Stering...aaa)
  6. spring 九种设计模式
  7. Android 复制文本内容到系统剪贴板(自由复制)
  8. python 上手
  9. java HttpURLConnection 登录网站 完整代码
  10. SQL语句注意得问题