MySQLStudy之--MySQL工具mysqlshow_MySQL
MySQL Study之--MySQL工具mysqlshow mmysqlshow客户可用来很快地查找存在哪些数据库,数据库中的表,表中的列或索 mysqlshow为一些SQL显示语句提供了一个命令行界面。相同的信息可以通过直接使用那些语句获得。例如,你可以从mysql客户程序发出它们。 象这样调用mysqlshow:shell> mysqlshow[选项] [db_name [tbl_name [col_name]]
|
案例:
[root@mysrv mysql]# mysqlshow --help mysqlshow Ver 9.10 Distrib 5.1.66, for redhat-linux-gnu (x86_64) Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Shows the structure of a MySQL database (databases, tables, and columns). Usage: mysqlshow [OPTIONS] [database [table [column]]] If last argument contains a shell or SQL wildcard (*,?,% or _) then only what's matched by the wildcard is shown. If no database is given then all matching databases are shown. If no table is given, then all matching tables in database are shown. If no column is given, then all matching columns and column types in table are shown. Default options are read from the following files in the given order: /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf The following groups are read: mysqlshow client The following options may be given as the first argument: --print-defaults Print the program argument list and exit. --no-defaults Don't read default options from any option file. --defaults-file=# Only read default options from the given file #. --defaults-extra-file=# Read this file after the global files are read. -c, --character-sets-dir=name Directory for character set files. --default-character-set=name Set the default character set. --count Show number of rows per table (may be slow for non-MyISAM tables). -C, --compress Use compression in server/client protocol. -#, --debug[=name] Output debug log. Often this is 'd:t:o,filename'. --debug-check Check memory and open file usage at exit. --debug-info Print some debug info at exit. -?, --help Display this help and exit. -h, --host=name Connect to host. -i, --status Shows a lot of extra information about each table. -k, --keys Show keys for table. -p, --password[=name] Password to use when connecting to server. If password is not given, it's solicited on the tty. -P, --port=# Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). --protocol=name The protocol to use for connection (tcp, socket, pipe, memory). -t, --show-table-type Show table type column. -S, --socket=name The socket file to use for connection. --ssl Enable SSL for connection (automatically enabled with other flags).Disable with --skip-ssl. --ssl-ca=name CA file in PEM format (check OpenSSL docs, implies --ssl). --ssl-capath=name CA directory (check OpenSSL docs, implies --ssl). --ssl-cert=name X509 cert in PEM format (implies --ssl). --ssl-cipher=name SSL cipher to use (implies --ssl). --ssl-key=name X509 key in PEM format (implies --ssl). --ssl-verify-server-cert Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default. -u, --user=name User for login if not current user. -v, --verbose More verbose output; you can use this multiple times to get even more verbose output. -V, --version Output version information and exit. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ----------------------------- character-sets-dir (No default value) default-character-set latin1 count FALSE compress FALSE debug-check FALSE debug-info FALSE host (No default value) status FALSE keys FALSE port 3306 show-table-type FALSE socket /tmp/mysql.sock ssl FALSE ssl-ca (No default value) ssl-capath (No default value) ssl-cert (No default value) ssl-cipher (No default value) ssl-key (No default value) ssl-verify-server-cert FALSE user (No default value)<strong> </strong>
1、不指定查看的database
[root@mysrv mysql]# mysqlshow -uroot -poracle
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| mysqlslap |
| performance_schema |
| prod |
| sakila |
| test |
+--------------------+
2、指定查看的database
[root@mysrv mysql]# mysqlshow -uroot -poracle mysql
Database: mysql
+---------------------------+
| Tables |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| innodb_index_stats |
| innodb_table_stats |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
[root@mysrv mysql]# mysqlshow -uroot -poracle prod
Database: prod
+--------+
| Tables |
+--------+
| t1 |
| t2 |
| t3 |
| t4 |
+--------+
3、查看指定
[root@mysrv mysql]# mysqlshow -uroot -poracle prod t1Database: prod Table: t1
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| id | int(11) | | NO | PRI | 0 | | select,insert,update,references | |
| name | varchar(10) | latin1_swedish_ci | YES | | | | select,insert,update,references | |
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+---------+

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

This article introduces a variety of methods and tools to monitor PostgreSQL databases under the Debian system, helping you to fully grasp database performance monitoring. 1. Use PostgreSQL to build-in monitoring view PostgreSQL itself provides multiple views for monitoring database activities: pg_stat_activity: displays database activities in real time, including connections, queries, transactions and other information. pg_stat_replication: Monitors replication status, especially suitable for stream replication clusters. pg_stat_database: Provides database statistics, such as database size, transaction commit/rollback times and other key indicators. 2. Use log analysis tool pgBadg

This article describes how to optimize ZooKeeper performance on Debian systems. We will provide advice on hardware, operating system, ZooKeeper configuration and monitoring. 1. Optimize storage media upgrade at the system level: Replacing traditional mechanical hard drives with SSD solid-state drives will significantly improve I/O performance and reduce access latency. Disable swap partitioning: By adjusting kernel parameters, reduce dependence on swap partitions and avoid performance losses caused by frequent memory and disk swaps. Improve file descriptor upper limit: Increase the number of file descriptors allowed to be opened at the same time by the system to avoid resource limitations affecting the processing efficiency of ZooKeeper. 2. ZooKeeper configuration optimization zoo.cfg file configuration

The network configuration of the Debian system is mainly implemented through the /etc/network/interfaces file, which defines network interface parameters, such as IP address, gateway, and DNS server. Debian systems usually use ifup and ifdown commands to start and stop network interfaces. By modifying the ifeline in the interfaces file, you can set a static IP or use DHCP to dynamically obtain the IP address. It should be noted that Debian12 and subsequent versions no longer use NetworkManager by default, so other command-line tools, such as IP commands, may be required to manage network interfaces. You can edit /etc/netwo

To strengthen the security of Oracle database on the Debian system, it requires many aspects to start. The following steps provide a framework for secure configuration: 1. Oracle database installation and initial configuration system preparation: Ensure that the Debian system has been updated to the latest version, the network configuration is correct, and all required software packages are installed. It is recommended to refer to official documents or reliable third-party resources for installation. Users and Groups: Create a dedicated Oracle user group (such as oinstall, dba, backupdba) and set appropriate permissions for it. 2. Security restrictions set resource restrictions: Edit /etc/security/limits.d/30-oracle.conf

Mastering Debian system log monitoring is the key to efficient operation and maintenance. It can help you understand the system's operating conditions in a timely manner, quickly locate faults, and optimize system performance. This article will introduce several commonly used monitoring methods and tools. Monitoring system resources with the sysstat toolkit The sysstat toolkit provides a series of powerful command line tools for collecting, analyzing and reporting various system resource metrics, including CPU load, memory usage, disk I/O, network throughput, etc. The main tools include: sar: a comprehensive system resource statistics tool, covering CPU, memory, disk, network, etc. iostat: disk and CPU statistics. mpstat: Statistics of multi-core CPUs. pidsta

Downloading software from official Debian or reliable sources is crucial. The following steps and suggestions can effectively ensure the security of the downloaded Debian system or software package: 1. Verify the integrity of the software package After downloading the Debian image, be sure to use MD5 or SHA256 and other checksums to verify its integrity to prevent malicious tampering. 2. Choose a secure mirror source to always download from the Debian official website or a reputable third-party mirror site. Priority is given to official certification or mirroring sources provided by large institutions. 3. Keep the system updates and installation immediately after running sudoaptupdate&&sudoaptupgrade to fix potential security vulnerabilities. It is recommended to install unattend
