- 浏览: 231507 次
- 性别:
- 来自: 湖南
最新评论
-
yuxuejun1123:
为什么没有powerPC,个人觉得这篇文章把mips和powe ...
ARM MIPS PowerPC比较 -
yy232:
我刚学这个,有点疑问,希望你能为我解答 你说 “任何人只 ...
centos的用户、组权限、添加删除用户等操作的详细操作命令 -
wstxdz1023:
就那么几句代码,全是问题
socket 心跳
mysql -u root -p
进入到mysql客户端应用程序mysql,通过它可以管理数据库
1. 获取帮助
mysql>help或者/?
2. 将在mysql>下输入的内容输出到文件中,使用
mysql>tee filename或者\T filename
mysql会提示你已经logging to file 'filename'
这样在mysql>下输入的命令及输出结果就会都保存到filename文件中
如果想取消挂载,输入 notee或者\t
mysql会提示outfile disabled
在进入mysql之前,也可以通过选项--tee或者--no-tee挂载外部文件或者取消
mysql -u root -p --tee outfile
或者
mysql -u root -p --no-tee
3.
mysql>tee mysql_help.txt
将输出挂载到mysql_help.txt文件上
输入mysql>help显示输出信息
mysql> help
For information about MySQL products and services, visit:
< type="text/javascript"> http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
http://dev.mysql.com/
To buy MySQL Network Support, training, or other products, visit:
https://shop.mysql.com/
List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
? (\?) Synonym for `help'.
help (\h) Display this help.
clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
ego (\G) Send command to mysql server, display result vertically.
go (\g) Send command to mysql server.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
notee (\t) Don't write into outfile.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. < type="text/javascript">
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
exit (\q) Exit mysql. Same as quit.
quit (\q) Quit mysql.
For server side help, type 'help contents'
4. 常用命令示例
a. mysql>?或者help
b. mysql> show databases \G
*************************** 1. row ***************************
Database: information_schema
*************************** 2. row ***************************
Database: broker
*************************** 3. row ***************************
Database: gene2pubmed
*************************** 4. row ***************************
Database: mysql
*************************** 5. row ***************************
Database: test
5 rows in set (0.00 sec)
c.
mysql>tee [outfile] 不输入outfile,则使用上次挂载的文件
mysql>notee 取消挂载
d. mysql>status 显示状态信息
e. mysql>use database_name
f.
定义一个文件sql_script,内容为sql语句,使用source执行文件中的sql script
如sql_script文件中保存show databases;
mysql>source sql_script
会显示sql_script中show databases;执行的结果
此外注意,获取server side的帮助可以使用 help contents命令
mysql>下输入help contents查询各种帮助。
当要完成某项功能的时候,又不知道该用哪个命令的时候可以在mysql>下输入help contents查询帮助文档,了解各个命令的功能。
2.
mysql>help contents获取查询结果
mysql> help contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers
//如下highlight的命令为常用命令,通过help item_name可以查看其具体功能
帐号管理
mysql> help account management
You asked for help about help category: " Account Management"
For more information, type 'help <item>', where <item> is one of the following
topics:
CREATE USER
//创建一个用户
DROP USER
//删除一个用户
GRANT
//为用户赋予权限
RENAME USER
REVOKE
SET PASSWORD
//为某个用户设置帐户
数据库管理
mysql> help administration
You asked for help about help category: " Administration"
For more information, type 'help <item>', where <item> is one of the following
topics:
DESCRIBE
//描述信息,可以用它输出数据表结构,help DESCRIBE查看更多信息
FLUSH QUERY CACHE
HELP COMMAND
HELP STATEMENT
数据定义
mysql> help data definition
You asked for help about help category: "Data Definition"
For more information, type 'help <item>', where <item> is one of the following
topics:
ALTER DATABASE
//修改数据库
ALTER TABLE
//修改数据表结构
ALTER VIEW
CONSTRAINT
CREATE DATABASE
//创建一个数据库
CREATE INDEX
//创建一个索引,help create index了解更多
CREATE TABLE
//创建一个数据表
CREATE VIEW
DROP DATABASE
DROP INDEX
DROP TABLE
DROP VIEW
MERGE
RENAME TABLE
数据操作
mysql> help data manipulation
You asked for help about help category: " Data Manipulation"
For more information, type 'help <item>', where <item> is one of the following
topics:
CACHE INDEX
CHANGE MASTER TO
DEALLOCATE PREPARE
DELETE
DO
DUAL
EXECUTE STATEMENT
EXPLAIN
Syntax:
EXPLAIN tbl_name
//等同于DESCRIBE table_name,显示数据表定义结构
Or:
EXPLAIN [EXTENDED] SELECT select_options
//显示MySQL执行SELECT语句的细节,方便采取优化策略
The EXPLAIN statement can be used either as a synonym for DESCRIBE or as a way to obtain information about how MySQL executes a SELECT statement:
o EXPLAIN tbl_name is synonymous with DESCRIBE tbl_name or SHOW COLUMNS FROM tbl_name.
o When you precede a SELECT statement with the keyword EXPLAIN, MySQL displays information from the optimizer about the query execution plan. That is, MySQL explains how it would process the SELECT, including information about how tables are joined and in which order.
FLUSH
HANDLER
INSERT
//插入数据
INSERT DELAYED
INSERT SELECT
//使用INSERT SELECT可以将从一个或多个数据表SELECT的结果插入到另一个表格中
JOIN
//MySQL中的多表连接操作,详细情况help join
KILL
//客户端连接到mysql的server即mysqld,都是独立的线程thread,通过show processlist可以查看连接到mysqld server的各个线程的id,通过kill可以结束当前连接(CONNECTION)或者查询(QUERY)的线程
LOAD DATA
//从指定目录导入数据,help load data了解更多信息
LOAD DATA FROM MASTER
LOAD INDEX
LOAD TABLE FROM MASTER
PREPARE
PURGE MASTER LOGS
REPLACE INTO
RESET
RESET MASTER
RESET SLAVE
SELECT
//SELECT除了用于从数据库中检索满足所定义条件的制定列之外,还可以返回和任何table都无关的数据信息,如SELECT 1+1
SET
SET GLOBAL SQL_SLAVE_SKIP_COUNTER
SET SQL_LOG_BIN
SHOW has many forms that provide information about databases, tables,
columns, or status information about the server. This section describes
//MySQL的SHOW功能很强大,通过help show可以查看更加详细的功能,显示数据库,数据表以及列,以及Server的状态信息
SHOW
SHOW BINARY LOGS
SHOW BINLOG EVENTS
SHOW CHARACTER SET
SHOW COLLATION
SHOW COLUMNS
SHOW CREATE DATABASE
SHOW CREATE PROCEDURE
SHOW CREATE TABLE
SHOW CREATE VIEW
SHOW DATABASES
SHOW ENGINE
SHOW ENGINES
SHOW ERRORS
SHOW GRANTS
SHOW INDEX
SHOW INNODB STATUS
SHOW LOGS
SHOW MASTER STATUS
SHOW MUTEX STATUS
SHOW OPEN TABLES
SHOW PRIVILEGES
SHOW PROCEDURE CODE
SHOW PROCEDURE STATUS
SHOW PROCESSLIST
SHOW PROFILES
SHOW SLAVE HOSTS
SHOW SLAVE STATUS
SHOW STATUS
SHOW TABLE STATUS
SHOW TABLES
SHOW TRIGGERS
SHOW VARIABLES
SHOW WARNINGS
START SLAVE
STOP SLAVE
TRUNCATE TABLE
UNION
UPDATE
MySQL支持的数据类型
mysql> help data types
You asked for help about help category: "Data Types"
For more information, type 'help <item>', where <item> is one of the following
topics:
AUTO_INCREMENT
BIGINT
BINARY
BIT
BLOB
BLOB DATA TYPE
BOOLEAN
CHAR
CHAR BYTE
DATE
DATETIME
DEC
DECIMAL
DOUBLE
DOUBLE PRECISION
ENUM
FLOAT
INT
INTEGER
LONGBLOB
LONGTEXT
MEDIUMBLOB
MEDIUMINT
MEDIUMTEXT
SET DATA TYPE
SMALLINT
TEXT
TIME
TIMESTAMP
TINYBLOB
TINYINT
TINYTEXT
VARBINARY
VARCHAR
YEAR DATA TYPE
函数
mysql> help functions
You asked for help about help category: " Functions"
For more information, type 'help <item>', where <item> is one of the following
topics:
CREATE FUNCTION
DROP FUNCTION
PROCEDURE ANALYSE
categories:
Bit Functions
Comparison operators
Control flow functions
Date and Time Functions
Encryption Functions
Information Functions
Logical operators
Miscellaneous Functions
Numeric Functions
String Functions
等等更多
< type="text/javascript">
发表评论
-
MYSQL中删除重复记录的方法
2011-05-10 11:41 918在实际应用中,很可能会碰到一些需要删除某些字段的重复记录,我现 ... -
MySQL查询及删除重复记录的方法
2011-05-10 11:37 985查询及删除重复记录的 ... -
Mysql数据库编码问题3(修改数据库,表,字段编码为utf8)
2011-05-06 16:19 1701个人建议,数据库字符 ... -
MySQL 备份和恢复
2011-05-06 16:01 836目前 MySQL 支持的免费备份工具有:mysqldump ... -
修改及查看mysql数据库的字符集
2011-05-06 15:50 888Liunx下修改MySQL字符集:1.查找MySQL的cnf文 ... -
命令行下把SQL结果导出到文本文件的方法小结
2011-05-06 14:37 5102有时候需要把数据库中的某些SQL语句结果导出到一个文件中,小结 ... -
Mysql中的 的 Cascade ,NO ACTION ,Restrict ,SET NULL
2011-05-06 14:26 1317外键约束对子表的含义: 如果在父表中找不到候选键,则 ... -
FOREIGN KEY Constraints
2011-05-06 14:21 911InnoDB supports foreign key c ... -
mysql的默认查询优先还是更新(insert、update、delete)优先关系
2011-05-06 14:19 1642查询优先还是更新(inse ... -
MySQL索引类型一览 让MySQL高效运行起来
2011-05-06 12:10 873索引是快速搜索的关键。MySQL索引的建立对于MySQL的 ... -
MySQL数据库支持的引擎
2011-04-25 16:57 641ISAM ISAM是一个定义明确且历经时间考验的数据表格管理 ... -
MysqlERROR 1005错误处理
2011-04-25 16:40 1233在使用MySQL的时候,在操作不当时,很容易出现 ERROR ... -
修改及查看mysql数据库的字符集
2011-04-22 15:35 936Liunx下修改MySQL字符集:1.查找MySQL的cnf文 ... -
mysql 编码
2011-04-08 18:59 888mysql 查看编码; show variables lik ...
相关推荐
Mysql命令帮助(使用help或者help contents)
本文主要给大家介绍了Mysql使用命令分级查找帮助的相关内容,本文章样例基于msql的分支版本MariaDB-10.1.19,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍: 查询所有帮助 我们如果希望知道...
如何将MySQL help contents的内容有层次的输出呢?下面小编就为大家带来一篇将MySQL help contents的内容有层次的输出方法推荐。小编觉得挺不错的,现在分享给大家,给大家一个参考。一起跟随小编过来看看吧
Table of Contents Preface, Notes, Licenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
mysql> help contents; You asked for help about help category: "Contents" For more information, type 'help <item>', where <item> is one of the following categories: Account Management Administration ...
The sample creates a new database file and allows you to view, add, or delete records in this database."<END><br>2 , dbprint.zip<br>This demonstrates how to print data from a database.<END><br>3 , ...
The contents are divided into four sections: The first section consists of the basics of R, which explains the advantages of using R, the installation of different versions of R, and the 12 ...
CHAPTER 1 Introduction to MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Database, ...
Professional Website Performance: Optimizing the Front End and Back End offers essential information to help both front-end and back-end technicians ensure better website performance. From the Back ...
它更能把握搜索引擎,在你使用 WordPress 并掌握几种插件后,对于优化将不用过多的操心,它会为你想的更多。 WordPress有许多第三方开发的免费模板,安装方式简单易用。不过要做一个自己的模板,则需要你有一定的...
Table of Contents PHP 5 Fast & Easy Web Development Introduction Part I - Getting Started Chapter 1 - Installing and Configuring MySQL Chapter 2 - Installing Apache Chapter 3 - Installing...
Table of Contents Chapter 1: The World Wide Web Chapter 2: HTML Chapter 3: CSS Chapter 4: JavaScript Chapter 5: PHP Chapter 6: PHP and MySQL Chapter 7: jQuery Chapter 8: Ajax Chapter 9: The History ...
Key Features ...This book is packed with real-life examples to help you implement the concepts as you learn Book Description ... ... You will set up ...
Plug-n-play source code and popular Ajax framework libraries to help you reduce tedious typing and shorten programming tasks. Learn how to… Build better, more interactive interfaces for your web ...
A practical guide filled with easy-to-understand programming examples to help you gain hands-on experience with Java EE development using WildFly Who This Book Is For This book is for professional ...
A practical guide filled with easy-to-understand programming examples to help you gain hands-on experience with Java EE development using WildFly Who This Book Is For This book is for professional ...
=====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE...
是使用PHP语言加上MySQL数据库所开发的软件系统,可以在Linux、 Windows、MacOSX等各种不同的平台上执行。目前是由Open Source Matters (www.opensourcematters.org)这个开放源码组织进行开发与支持,这个组织的成员...
Chapter 13: Project 4: Using MySQL to Store Data Chapter 14: Project 5: Using a Web Server to Control Hardware Chapter 15: Project 6: Windows IoT and Arduino Chapter 16: Azure IoT Solutions: Cloud ...
Chapter 12: Going Further: Getting Help and Troubleshooting 305 Going beyond maps 305 Delivering vector data 306 Time for action – retrieving vector data 306 Delivering raster data 310 Time for ...