http://hi.baidu.com/aaxh/blog/item/49bcb78ffe3dfae4f01f36b2.html一、MySQL 连接本地数据库,用户名为“root”,密码“123”(注意:“-p”和“123” 之间不能有空格)

C:\>mysql -h localhost -u root -p123(注意-p与密码是紧跟的)

二、MySQL 连接远程数据库(192.168.0.201),端口“3306”,用户名为“root”,密码“123”

C:\>mysql -h 172.16.16.45 -P 3306 -u root -p123

三、MySQL 连接本地数据库,用户名为“root”,隐藏密码

C:\>mysql -h localhost -u root -p

Enter password:

四、MySQL 连接本地数据库,用户名为“root”,指定所连接的数据库为“test”

C:\>mysql -h localhost -u root -p123 -D test

mysql>select database();

+------------+

| database() |

+------------+

| test       |

+------------+

下面是 MySQL 客户端命令的详细参数:

mysql  Ver 14.12 Distrib 5.0.41, for Win32 (ia32)

Copyright (C) 2002 MySQL AB

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL license

Usage: mysql [OPTIONS] [database]

-?, --help          Display this help and exit.

-I, --help          Synonym for -?

--auto-rehash       Enable automatic rehashing. One doesn't need to use

'rehash' to get table and field completion, but startup

and reconnecting may take a longer time. Disable with

--disable-auto-rehash.

-A, --no-auto-rehash

No automatic rehashing. One has to use 'rehash' to get

table and field completion. This gives a quicker start of

mysql and disables rehashing on reconnect. WARNING:

options deprecated; use --disable-auto-rehash instead.

-B, --batch         Don't use history file. Disable interactive behavior.

(Enables --silent)

--character-sets-dir=name

Directory where character sets are.

--default-character-set=name

Set the default character set.

-C, --compress      Use compression in server/client protocol.

-#, --debug[=#]     This is a non-debug version. Catch this and exit

-D, --database=name Database to use.

--delimiter=name    Delimiter to be used.

-e, --execute=name  Execute command and quit. (Disables --force and history

file)

-E, --vertical      Print the output of a query (rows) vertically.

-f, --force         Continue even if we get an sql error.

-G, --named-commands

Enable named commands. Named commands mean this program's

internal commands; see mysql> help . When enabled, the

named commands can be used from any line of the query,

otherwise only from the first line, before an enter.

Disable with --disable-named-commands. This option is

disabled by default.

-g, --no-named-commands

Named commands are disabled. Use \* form only, or use

named commands only in the beginning of a line ending

with a semicolon (;) Since version 10.9 the client now

starts with this option ENABLED by default! Disable with

'-G'. Long format commands still work from the first

line. WARNING: option deprecated; use

--disable-named-commands instead.

-i, --ignore-spaces Ignore space after function names.

--local-infile      Enable/disable LOAD DATA LOCAL INFILE.

-b, --no-beep       Turn off beep on error.

-h, --host=name     Connect to host.

-H, --html          Produce HTML output.

-X, --xml           Produce XML output

--line-numbers      Write line numbers for errors.

-L, --skip-line-numbers

Don't write line number for errors. WARNING: -L is

deprecated, use long version of this option instead.

-n, --unbuffered    Flush buffer after each query.

--column-names      Write column names in results.

-N, --skip-column-names

Don't write column names in results. WARNING: -N is

deprecated, use long version of this options instead.

-O, --set-variable=name

Change the value of a variable. Please note that this

option is deprecated; you can set variables directly with

--variable-name=value.

--sigint-ignore     Ignore SIGINT (CTRL-C)

-o, --one-database  Only update the default database. This is useful for

skipping updates to other database in the update log.

-p, --password[=name]

Password to use when connecting to server. If password is

not given it's asked from the tty.

-W, --pipe          Use named pipes to connect to server.

-P, --port=#        Port number to use for connection.

--prompt=name       Set the mysql prompt to this value.

--protocol=name     The protocol of connection (tcp,socket,pipe,memory).

-q, --quick         Don't cache result, print it row by row. This may slow

down the server if the output is suspended. Doesn't use

history file.

-r, --raw           Write fields without conversion. Used with --batch.

--reconnect         Reconnect if the connection is lost. Disable with

--disable-reconnect. This option is enabled by default.

-s, --silent        Be more silent. Print results with a tab as separator,

each row on new line.

--shared-memory-base-name=name

Base name of shared memory.

-S, --socket=name   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.

-t, --table         Output in table format.

-T, --debug-info    Print some debug info at exit.

--tee=name          Append everything into outfile. See interactive help (\h)

also. Does not work in batch mode. Disable with

--disable-tee. This option is disabled by default.

--no-tee            Disable outfile. See interactive help (\h) also. WARNING:

option deprecated; use --disable-tee instead

-u, --user=name     User for login if not current user.

-U, --safe-updates  Only allow UPDATE and DELETE that uses keys.

-U, --i-am-a-dummy  Synonym for option --safe-updates, -U.

-v, --verbose       Write more. (-v -v -v gives the table output format).

-V, --version       Output version information and exit.

-w, --wait          Wait and retry if connection is down.

--connect_timeout=# Number of seconds before connection timeout.

--max_allowed_packet=#

Max packet length to send to, or receive from server

--net_buffer_length=#

Buffer for TCP/IP and socket communication

--select_limit=#    Automatic limit for SELECT when using --safe-updates

--max_join_size=#   Automatic limit for rows in a join when using

--safe-updates

--secure-auth       Refuse client connecting to server if it uses old

(pre-4.1.1) protocol

--show-warnings     Show warnings after every statement.

Default options are read from the following files in the given order:

C:\my.ini C:\my.cnf C:\WINDOWS\my.ini C:\WINDOWS\my.cnf D:\MySQL\my.ini D:\MySQL\my.cnf

The following groups are read: mysql client

The following options may be given as the first argument:

--print-defaults Print the program argument list and exit

--no-defaults  Do not read default options from any options file

--defaults-file=# Only read default options from the given file #

--defaults-extra-file=# Read this file after the global files are read

Variables (--variable-name=value)

and boolean options {FALSE|TRUE}  Value (after reading options)

--------------------------------- -----------------------------

auto-rehash                       TRUE

character-sets-dir                (No default value)

default-character-set             utf8

compress                          FALSE

database                          (No default value)

delimiter                         ;

vertical                          FALSE

force                             FALSE

named-commands                    FALSE

local-infile                      FALSE

no-beep                           FALSE

host                              (No default value)

html                              FALSE

xml                               FALSE

line-numbers                      TRUE

unbuffered                        FALSE

column-names                      TRUE

sigint-ignore                     FALSE

port                              3306

prompt                            mysql>

quick                             FALSE

raw                               FALSE

reconnect                         TRUE

shared-memory-base-name           (No default value)

socket                            (No default value)

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

table                             FALSE

debug-info                        FALSE

user                              (No default value)

safe-updates                      FALSE

i-am-a-dummy                      FALSE

connect_timeout                   0

max_allowed_packet                16777216

net_buffer_length                 16384

select_limit                      1000

max_join_size                     1000000

secure-auth                       FALSE

show-warnings                     FALSE

linux 下远程连接mysql命令详解的更多相关文章

  1. Linux下的压缩解压缩命令详解

    linux zip命令zip -r myfile.zip ./*将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件. 2.unzipunzip -o - ...

  2. Linux下的压缩解压缩命令详解及实例

    实例:压缩服务器上当前目录的内容为xxx.zip文件 zip -r xxx.zip ./* 解压zip文件到当前目录 unzip filename.zip ====================== ...

  3. linux下last与lastb命令详解

    在linux系统中,last与lastb命令用来列出目前与过去登录系统的用户相关信息.指令英文原义: last, lastb - show listing of last logged in user ...

  4. Linux下远程连接MySQL数据库

    估计搞了一个多小时才把这个远程连接搞好.一台本地电脑,一台云服务器,都是linux系统. 步骤 在服务器端开启远程访问 首先进入mysql数据库,然后输入下面两个命令: grant all privi ...

  5. Linux下tar压缩解压缩命令详解

    tar -c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个.下面的 ...

  6. Linux下的tr编辑器命令详解

    通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能.您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符.您也可以用它来除去重复 ...

  7. linux下find和grep命令详解

    在linux下面工作,有些命令能够大大提高效率.本文就向大家介绍find.grep命令,他哥俩可以算是必会的linux命令,我几乎每天都要用到他们.本文结构如下: find命令 find命令的一般形式 ...

  8. Linux下的scp拷贝命令详解

    相同Linux系统中对文件复制拷贝可以用CP命令: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案, ...

  9. Linux下的grep搜索命令详解(一)

    Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来.grep全称是Global Regular Expression Print,表示全局正则表达 ...

随机推荐

  1. 【bfs+优先队列】POJ2312-Battle City

    [思路] 题目中的“可以沿直线发射打破砖墙”可能会迷惑到很多人,实际上可以等价理解为“通过砖墙的时间为2个单位”,这样题目就迎刃而解了.第一次碰到时可能不能很好把握,第二次基本就可以当作水题了. [错 ...

  2. bzoj 1636: [Usaco2007 Jan]Balanced Lineup -- 线段树

    1636: [Usaco2007 Jan]Balanced Lineup Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 772  Solved: 560线 ...

  3. opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析

    SiftDescriptorExtractor对应于SIFT算法中特征向量提取的工作,通过他对关键点周围邻域内的像素分块进行梯度运算,得到128维的特征向量.具体有如下几个操作: 0.首先,我们假设在 ...

  4. #iOS问题记录#UITableView加载后直接滑动倒最底部

    类似QQ的聊天框,当进入聊天框,直接滑动倒最底部: 需要先将以他变了view滚动倒底部,再来移动NSIndexPath, 代码如下: -(void) doForceScrollToBottom { d ...

  5. STL迭代器及迭代器失效问题

    迭代器失效: 典型的迭代器失效. 首先对于vector而言,添加和删除操作可能使容器的部分或者全部迭代器失效.那为什么迭代器会失效呢?vector元素在内存中是顺序存储,试想:如果当前容器中已经存在了 ...

  6. Phpstorm-sftp配置

      保存就可以了 随便点一个文件,右键就可以了,保存,上传快捷键

  7. .NET开源免费的功能强大控件库

    通信工具IM控件: http://www.cnblogs.com/hubro/p/4316315.html 360安全卫士及QQ部分控件经典皮肤下载 http://www.sufeinet.com/t ...

  8. JavaScrip数组去重--终极版

    第一种 var arr = [1,2,3,4,1,2,4,5,6];console.log(arr); Array.prototype.unique = function() { var n = [] ...

  9. JDK 7中的函数式编程思想[转载]

    原文作者的观点是Lambda表达式一定会包含在JDK 7中,而全文也着重介绍了这方面的知识,作者认为函数式编程的概念也将出现在JDK 7中. Lambda表达式 Lambda表达式并不是什么新概念,自 ...

  10. [NM 状态机2] Container状态机详解

    概述 前面已经分析了RM的状态机,接下来将分析NM的状态机,NM状态机包括Container,Application,LocalizedResource三个,其中Container相对较复杂.现在我们 ...