MYSQL 连接数据库命令收藏

<p>一、MySQL 连接本地数据库,用户名为&quot;root&quot;,密码&quot;123&quot;(注意:&quot;-p&quot;和&quot;123&quot; 之间不能有空格)</p><pre class="brush:bash;toolbar:false">C:\&gt;mysql-hlocalhost-uroot-p123</pre><p>二、MySQL 连接远程数据库(192.168.0.201),端口&quot;3306&quot;,用户名为&quot;root&quot;,密码&quot;123&quot;</p><pre class="brush:bash;toolbar:false">C:\&gt;mysql-h172.16.16.45-P3306-uroot-p123</pre><p>三、MySQL 连接本地数据库,用户名为&quot;root&quot;,隐藏密码</p><pre class="brush:bash;toolbar:false">C:\&gt;mysql-hlocalhost-uroot-p</pre><p>Enter password:</p><p>四、MySQL 连接本地数据库,用户名为&quot;root&quot;,指定所连接的数据库为&quot;test&quot;</p><pre class="brush:bash;toolbar:false">C:\&gt;mysql-hlocalhost-uroot-p123-Dtest mysql&gt;selectdatabase(); +------------+ |database()| +------------+ |test| +------------+</pre><p>下面是 MySQL 客户端命令的详细参数:</p><pre class="brush:bash;toolbar:false">mysqlVer14.12Distrib5.0.41,forWin32(ia32) Copyright(C)2002MySQLAB ThissoftwarecomeswithABSOLUTELYNOWARRANTY.Thisisfreesoftware, andyouarewelcometomodifyandredistributeitundertheGPLlicense Usage:mysql[OPTIONS][database] -?,--helpDisplaythishelpandexit. -I,--helpSynonymfor-? --auto-rehashEnableautomaticrehashing.Onedoesn&#39;tneedtouse &#39;rehash&#39;togettableandfieldcompletion,butstartup andreconnectingmaytakealongertime.Disablewith --disable-auto-rehash. -A,--no-auto-rehash Noautomaticrehashing.Onehastouse&#39;rehash&#39;toget tableandfieldcompletion.Thisgivesaquickerstartof mysqlanddisablesrehashingonreconnect.WARNING: optionsdeprecated;use--disable-auto-rehashinstead. -B,--batchDon&#39;tusehistoryfile.Disableinteractivebehavior. (Enables--silent) --character-sets-dir=name Directorywherecharactersetsare. --default-character-set=name Setthedefaultcharacterset. -C,--compressUsecompressioninserver/clientprotocol. -#,--debug[=#]Thisisanon-debugversion.Catchthisandexit -D,--database=nameDatabasetouse. --delimiter=nameDelimitertobeused. -e,--execute=nameExecutecommandandquit.(Disables--forceandhistory file) -E,--verticalPrinttheoutputofaquery(rows)vertically. -f,--forceContinueevenifwegetansqlerror. -G,--named-commands Enablenamedcommands.Namedcommandsmeanthisprogram&#39;s internalcommands;seemysql&gt;help.Whenenabled,the namedcommandscanbeusedfromanylineofthequery, otherwiseonlyfromthefirstline,beforeanenter. Disablewith--disable-named-commands.Thisoptionis disabledbydefault. -g,--no-named-commands Namedcommandsaredisabled.Use\*formonly,oruse namedcommandsonlyinthebeginningofalineending withasemicolon(;)Sinceversion10.9theclientnow startswiththisoptionENABLEDbydefault!Disablewith &#39;-G&#39;.Longformatcommandsstillworkfromthefirst line.WARNING:optiondeprecated;use --disable-named-commandsinstead. -i,--ignore-spacesIgnorespaceafterfunctionnames. --local-infileEnable/disableLOADDATALOCALINFILE. -b,--no-beepTurnoffbeeponerror. -h,--host=nameConnecttohost. -H,--htmlProduceHTMLoutput. -X,--xmlProduceXMLoutput --line-numbersWritelinenumbersforerrors. -L,--skip-line-numbers Don&#39;twritelinenumberforerrors.WARNING:-Lis deprecated,uselongversionofthisoptioninstead. -n,--unbufferedFlushbufferaftereachquery. --column-namesWritecolumnnamesinresults. -N,--skip-column-names Don&#39;twritecolumnnamesinresults.WARNING:-Nis deprecated,uselongversionofthisoptionsinstead. -O,--set-variable=name Changethevalueofavariable.Pleasenotethatthis optionisdeprecated;youcansetvariablesdirectlywith --variable-name=value. --sigint-ignoreIgnoreSIGINT(CTRL-C) -o,--one-databaseOnlyupdatethedefaultdatabase.Thisisusefulfor skippingupdatestootherdatabaseintheupdatelog. -p,--password[=name] Passwordtousewhenconnectingtoserver.Ifpasswordis notgivenit&#39;saskedfromthetty. -W,--pipeUsenamedpipestoconnecttoserver. -P,--port=#Portnumbertouseforconnection. --prompt=nameSetthemysqlprompttothisvalue. --protocol=nameTheprotocolofconnection(tcp,socket,pipe,memory). -q,--quickDon&#39;tcacheresult,printitrowbyrow.Thismayslow downtheserveriftheoutputissuspended.Doesn&#39;tuse historyfile. -r,--rawWritefieldswithoutconversion.Usedwith--batch. --reconnectReconnectiftheconnectionislost.Disablewith --disable-reconnect.Thisoptionisenabledbydefault. -s,--silentBemoresilent.Printresultswithatabasseparator, eachrowonnewline. --shared-memory-base-name=name Basenameofsharedmemory. -S,--socket=nameSocketfiletouseforconnection. --sslEnableSSLforconnection(automaticallyenabledwith otherflags).Disablewith--skip-ssl. --ssl-ca=nameCAfileinPEMformat(checkOpenSSLdocs,implies --ssl). --ssl-capath=nameCAdirectory(checkOpenSSLdocs,implies--ssl). --ssl-cert=nameX509certinPEMformat(implies--ssl). --ssl-cipher=nameSSLciphertouse(implies--ssl). --ssl-key=nameX509keyinPEMformat(implies--ssl). --ssl-verify-server-cert Verifyserver&#39;s&quot;CommonName&quot;initscertagainst hostnameusedwhenconnecting.Thisoptionisdisabledby default. -t,--tableOutputintableformat. -T,--debug-infoPrintsomedebuginfoatexit. --tee=nameAppendeverythingintooutfile.Seeinteractivehelp(\h) also.Doesnotworkinbatchmode.Disablewith --disable-tee.Thisoptionisdisabledbydefault. --no-teeDisableoutfile.Seeinteractivehelp(\h)also.WARNING: optiondeprecated;use--disable-teeinstead -u,--user=nameUserforloginifnotcurrentuser. -U,--safe-updatesOnlyallowUPDATEandDELETEthatuseskeys. -U,--i-am-a-dummySynonymforoption--safe-updates,-U. -v,--verboseWritemore.(-v-v-vgivesthetableoutputformat). -V,--versionOutputversioninformationandexit. -w,--waitWaitandretryifconnectionisdown. --connect_timeout=#Numberofsecondsbeforeconnectiontimeout. --max_allowed_packet=# Maxpacketlengthtosendto,orreceivefromserver --net_buffer_length=# BufferforTCP/IPandsocketcommunication --select_limit=#AutomaticlimitforSELECTwhenusing--safe-updates --max_join_size=#Automaticlimitforrowsinajoinwhenusing --safe-updates --secure-authRefuseclientconnectingtoserverifitusesold (pre-4.1.1)protocol --show-warningsShowwarningsaftereverystatement. Defaultoptionsarereadfromthefollowingfilesinthegivenorder: C:\my.iniC:\my.cnfC:\WINDOWS\my.iniC:\WINDOWS\my.cnfD:\MySQL\my.iniD:\MySQL\my.cnf Thefollowinggroupsareread:mysqlclient Thefollowingoptionsmaybegivenasthefirstargument: --print-defaultsPrinttheprogramargumentlistandexit --no-defaultsDonotreaddefaultoptionsfromanyoptionsfile --defaults-file=#Onlyreaddefaultoptionsfromthegivenfile# --defaults-extra-file=#Readthisfileaftertheglobalfilesareread Variables(--variable-name=value) andbooleanoptions{FALSE|TRUE}Value(afterreadingoptions) -------------------------------------------------------------- auto-rehashTRUE character-sets-dir(Nodefaultvalue) default-character-setutf8 compressFALSE database(Nodefaultvalue) delimiter; verticalFALSE forceFALSE named-commandsFALSE local-infileFALSE no-beepFALSE host(Nodefaultvalue) htmlFALSE xmlFALSE line-numbersTRUE unbufferedFALSE column-namesTRUE sigint-ignoreFALSE port3306 promptmysql&gt; quickFALSE rawFALSE reconnectTRUE shared-memory-base-name(Nodefaultvalue) socket(Nodefaultvalue) sslFALSE ssl-ca(Nodefaultvalue) ssl-capath(Nodefaultvalue) ssl-cert(Nodefaultvalue) ssl-cipher(Nodefaultvalue) ssl-key(Nodefaultvalue) ssl-verify-server-certFALSE tableFALSE debug-infoFALSE user(Nodefaultvalue) safe-updatesFALSE i-am-a-dummyFALSE connect_timeout0 max_allowed_packet16777216 net_buffer_length16384 select_limit1000 max_join_size1000000 secure-authFALSE show-warningsFALSE</pre>
RangeTime:0.008377s
RangeMem:211.55 KB
返回顶部 留言