MYSQL 连接数据库命令收藏

一、MySQL 连接本地数据库,用户名为“root”,密码“root”(注意:“-p”和“root” 之间不能有空格)

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

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

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

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

C:\>mysql -h localhost -u root -pEnter password:

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

C:\>mysql -h localhost -u root -proot -D testmysql>select database();+------------+| database() |+------------+| test       |+------------+


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

mysql  Ver 14.12 Distrib 5.0.41, for Win32 (ia32)Copyright (C) 2002 MySQL ABThis software comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to modify and redistribute it under the GPL licenseUsage: 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 startupand reconnecting may take a longer time. Disable with--disable-auto-rehash.-A, --no-auto-rehash No automatic rehashing. One has to use 'rehash' to gettable and field completion. This gives a quicker start ofmysql 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 historyfile)-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'sinternal commands; see mysql> help . When enabled, thenamed 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 isdisabled by default.-g, --no-named-commands Named commands are disabled. Use \* form only, or usenamed commands only in the beginning of a line endingwith a semicolon (;) Since version 10.9 the client nowstarts with this option ENABLED by default! Disable with'-G'. Long format commands still work from the firstline. 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 isdeprecated, 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 isdeprecated, use long version of this options instead.-O, --set-variable=name Change the value of a variable. Please note that thisoption 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 forskipping updates to other database in the update log.-p, --password[=name] Password to use when connecting to server. If password isnot 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 slowdown the server if the output is suspended. Doesn't usehistory 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 withother 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 againsthostname used when connecting. This option is disabled bydefault.-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 clientThe 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 readVariables (--variable-name=value)and boolean options {FALSE|TRUE}  Value (after reading options)--------------------------------- -----------------------------auto-rehash                       TRUEcharacter-sets-dir                (No default value)default-character-set             utf8compress                          FALSEdatabase                          (No default value)delimiter                         ;vertical                          FALSEforce                             FALSEnamed-commands                    FALSElocal-infile                      FALSEno-beep                           FALSEhost                              (No default value)html                              FALSExml                               FALSEline-numbers                      TRUEunbuffered                        FALSEcolumn-names                      TRUEsigint-ignore                     FALSEport                              3306prompt                            mysql> quick                             FALSEraw                               FALSEreconnect                         TRUEshared-memory-base-name           (No default value)socket                            (No default value)ssl                               FALSEssl-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            FALSEtable                             FALSEdebug-info                        FALSEuser                              (No default value)safe-updates                      FALSEi-am-a-dummy                      FALSEconnect_timeout                   0max_allowed_packet                16777216net_buffer_length                 16384select_limit                      1000max_join_size                     1000000secure-auth                       FALSEshow-warnings                     FALSE


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/498184.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CoCos Creator打包各类问题总结

CoCos Creator打包各类问题总结如果你的打包APK 出现 ‘黑屏\找不到Mould看这里!’JAVA JDK环境变量与构建 毫无关系!!!1. SDK NDK 配置2. 热更新问题3. 打包配置如果你的打包APK 出现 ‘黑屏\找不到Mould看这里!’ J…

AI 知名企业“云从科技”今宣布完成 B 轮融资,总计获 25 亿元资金支持

来源: DeepTech深科技 概要:近日,中国人工智能国家队云从科技正式完成 B 轮 5 亿元人民币融资,加上此前广州市政府对云从科技的 20 亿政府资金支持,此次总计获得 25 亿元发展资金。 近日,中国人工智能国家队…

Cocos Creator -构建打包 所有版本测试

Cocos Creator -构建打包 所有版本测试 目前在打包APK时,出现了种种问题,都是因为打包环境操作,所以为了解决所有同行的同惑 ***大菠萝***做了一系列测评 SDK26SDK27SDK28SDK29SDK30JDK18√√√√JDK19√√√JDK20√√√√√JDK21√JDK21 如…

Andrej Karpathy发文谈神经网络:这不仅仅是分类器,这是一种新的软件开发思想

作者: 晓凡 概要:有越来越多的传统编程语言(C、C、Java)等程序员开始学习机器学习/深度学习,而对机器学习/深度学习的研究人员来说,编程也是必备技巧。 有越来越多的传统编程语言(C、C、Java&am…

PineApple_Ninja.js

PineApple_Ninja.js 1.本章内容 2.理解函数的重要性 3.定义函数的方式 4.参数赋值 JavaScript中最关键的函数是:第一类对象(first-class objects) 函数与对象共同存在,函数也可以被视为其他任意类型的JS对象。 函数和普通数据类…

Java国际化资源绑定-----示例

mess.properties文件:helloHello World! msgHello,{0}!Today is {1}.mess_en_US.propertieshelloHello World! msgHello,{0}!Today is {1}. mess_zh_CN.properties(Properties Editor插件)hello您好! msg你好,{0}&…

微软为什么要公开AI系统测试数据集和度量指标?

来源: 微软研究院AI头条 概要:微软研究院Maluuba团队的研究员Samira Ebrahimi Kahou等人在研究如何利用人工智能理解柱线图和饼图中所包含的信息这一问题时遇到了一个难题:没有现成的数据集可以用来测试他们的假设。 微软研究院Maluuba团队的…

SHA384-算法解密

今天无意发现一款网页你懂得游戏 于是出于好奇就去玩了一会,看着小姐姐发卡。 于是打开抓包软件。 这里推荐大家准备好 1.抓包软件 2纸和笔 用来在10秒内完成计算 先来了解一下 sha384算法,很难破解 但是巧了,我就这么巧! 看了20多…

JS写纸牌发牌和动画(详细解剖)

先看演示 游戏构建准备 1.准备52张纸牌 2.一张桌布 3.编辑工具为 Visual Code 技术概要 1.对象操作 2.数据操作 3.JS animation动画 4.全局变量 function desen_x(){let that this;var desen["h_1","h_2","h_3","h_4","h_5&…

科技产品下一个重大突破将来自芯片堆叠技术

来源:网易科技 概要:作为几乎所有日常电子产品最基础的一个组件,微芯片正出现一种很有意思的现象。 作为几乎所有日常电子产品最基础的一个组件,微芯片正出现一种很有意思的现象。通常又薄又平的微芯片,如今却堆叠得像…

Inside Class Loaders

原文:http://onjava.com/pub/a/onjava/2003/11/12/classloader.htmlIn this part, I want to lay the groundwork on which we can start a discussion about dynamic and modular software systems. Class loaders may seem to be a dry topic, but I think it is …

Cocos creator -引擎解构

Cocos creator -引擎结构 在长期的开发中,发现cc对大型的手游加载项目的速度很慢,于是我产生了一种想法,想把 cocos creator移植在Linux上做开发,编译时在Windows。但是这样太麻烦了。索性,研究一下它的构造&#xff…

计算机视觉简介:历史、现状和发展趋势

来源:专知 概要:正像其它学科一样,一个大量人员研究了多年的学科,却很难给出一个严格的定义,模式识别如此,目前火热的人工智能如此,计算机视觉亦如此。 【导读】本文由中国科学院自动化研究所模…

MySQL Cookbook 学习笔记-02

1、分组后查找最大或最小值 2、根据“日期-时间”分组 3、“分组计算” 和 “全局计算” 同时存在查询中 4、删除一行数据,sequence 列会重新生成吗? 5、sequence 列指定值插入,不是我认为的不能指定值哦! 6、删除最大 sequence 行…

IIS-HTTPS(TSL)强制开启的方法和解决过时的安全问题

IIS-HTTPS(TSL)强制开启的方法和解决过时的安全问题 系统为:Windows server 2008R2 工具为:IIS6 数据库为: Windows Sql server 2014 证书为:腾讯云颁发的AC证书 首先你需要这几个工具 IISCrypto | 检测和为你配置最安全的 策略环境 手写reg注册表 | 来关闭本地的事件 Windo…

AI在医疗行业的最新进展

来源: Future智能 概要:随着人工智能、大数据等相关应用与理念的不断传播,越来越多曾经深入人心的观念被彻底撼动,当然,医疗行业也不例外。 随着人工智能、大数据等相关应用与理念的不断传播,越来越多曾经深…

用jar 命令打包war包

假定有一个Web应用:C:\myHomemyHome/WEB-INF/……myHome/files/……myHome/image/……myHome/src/……myHome/index.jsp在命令行窗口下执行如下命令:C:\>cd myHomeC:\myHome\>jar cvf myhome.war */ .解释:jar cvf [A》 war包…

SHA384-算法解密(2)还原元数据

SHA384-算法解密(2)还原元数据 上一次的讲解比较潦草,这次写的更全面详细一些。 首先各位,如果想要解开使用这个算法加密后的数据,必须先学会加密,才能解密。 声明:这里仅供学习研究,不要学了三脚猫功夫就…

美国《时代》周刊公布年度25大最佳发明名单

来源: 中国智慧城市导刊 概要:除了大名鼎鼎的iPhone X和特斯拉model 3,还有好多你可能还未听过的新奇玩意。 当地时间16日,美国《时代》周刊发布了2017年25大最佳发明名单。除了大名鼎鼎的iPhone X和特斯拉model 3,还有…

顶级隐写术,破坏一切解释器

什么是隐写术? 就编程来说,隐写的信息通过加密或混淆,其内容例如一张购物清单,一篇文章,一篇图画或者其他“伪装”(cover)的消息。 隐写的信息通常用一些传统的方法进行加密,然后用…