1, checkout the file to a local directory
svn checkout path (path is the directory on the server)
example: svn checkout svn: / / 192.168.1.1/pro/domain
shorthand: svn co
2, to add a new repository file
svn add file
for example: svn add test.php (added test.php)
svn add *. php (to add the current directory of all the php files)
3, will change the file to the repository
svn commit-m "LogMessage" [-N] [- no-unlock] PATH (if you chose to remain locked , on the use of-no-unlock switch)
for example: svn commit-m "add test file for my test" test.php
shorthand: svn CI
4, lock / unlock
svn lock-m "LockMessage" [- force] PATH
For example: svn lock-M "lock Test file" test.php
svn unlock PATH
5, updated to a version of the
svn update-rm path
for example:
svn Update if not followed by the directory, by default the current directory and subdirectories of all files update to the latest version.
svn update-r 200 test.php (the repository file test.php revert to version 200)
svn Update test.php (updated in the repository simultaneously, if the submission date, then when prompted, because of the conflict, the need First update, modify the file, then remove svn resolved, and finally submitted to commit)
abbreviation: svn up
6, to view the file or directory Status
1) svn status path (directory files and subdirectories of the state, the normal state is not shown)
[?: outside the control of svn; M: content is modified; C: conflict; A: pre-added to the repository; K: locked]
2) svn status-v path (display status of files and subdirectories)
in the first column remains the same, the first two displays working version, the third and fourth column shows the version number of the last modification and changes people.
Note: svn status, svn diff, and svn revert command in the absence of these three cases, the network can do, because svn locally. Svn to keep the local version of the original copy.
Shorthand: svn st
7, delete the file
svn delete path-m "delete test fle"
For example: svn delete svn: / / 192.168.1.1/pro/domain/test.php-m "delete test file"
or directly svn delete test. php and then svn ci-m 'delete test file', recommended the use of this
shorthand: svn (del, remove, RM)
8, view the log
svn log path
for example: svn log test.php shows all the changes the file records, and changes in its version number
9, to view file details
svn info path
for example: svn info test.php
10, the difference
svn diff path (the file will be modified compared with the basic version)
for example: test.php svn diff
svn diff-RM: n path (to the version difference between m and n version)
for example: svn diff-r 200:201 test.php
shorthand: svn di
11, the difference between the two versions will be merged into the current file
svn merge-rm: n path
such as : svn merge-r 200:205 test.php (the version of the difference between 200 and 205 merged into the current file, but usually in conflict, need to deal with)
12, SVN Help
Help svn
svn Help CI
----- ---------------------
These are the frequently used commands, the following written a few infrequently used
---------------- ----------
13, the repository of files and directories under the list of
svn list path
shows the directory path is the repository of all files and directories
abbreviated: svn ls
14, created into a new directory under version control
svn mkdir: created into a new directory under version control.
Usage: 1, mkdir PATH ...
2, mkdir URL ...
create a version-controlled directory.
1, each copy of PATH to specify the working directory will be created locally, and add a new
schedule to be submitted to the next.
2, each directory specified in a URL will be submitted to the warehouse through the immediate creation.
In both cases, all the intermediate directories must exist in advance.
15, restoring local changes
svn revert: to restore the original working copy of the file does not change (to restore most of the local modifications). revert:
Usage: revert PATH ...
Note: The order book does not access the network, and will remove the conflict situation. But it does not restore
the deleted directory
16, the code base URL change
svn switch (sw): Update working copy to a different URL.
Usage: 1, Switch URL [PATH]
2, Switch-RELOCATE FROM TO [PATH ...]
1, update your working copy, maps to a new URL, their behavior with the "svn update" like, will also
on file with the local file server consolidation. This is the working copy of the repository corresponding to the same branch or tag in a
way.
2, copy the URL rewriting job metadata to reflect changes on the URL alone. When the repository root URL changes
(such as program name or host name changes), but the working copy is still mapped to the same repository using the same directory
with this command to update the working copy of the correspondence between the warehouse.
17, to resolve conflicts
svn resolved: remove the working copy of the directory or file a "conflict" state.
Usage: resolved PATH ...
Note: The book is not in accordance with the command syntax to solve the conflict or remove the conflict markers; it just removes conflict
-related documents, and then let the PATH can be re-submitted.
18, output the contents of the specified file or URL.
svn cat target [@ version] ... If you specify a version, the version from the specified search.
svn cat-r PREV filename> filename (PREV is the previous version, you can write the specific version number, so the output can be submitted)
This Blog is intended to collect information of my various Intrests,pen my opinion on the information gathered and not intended to educate any one of the information posted,but are most welcome to share there view on them
Monday, July 11, 2011
svn command Help Manual
svn command usually have help, you can query through the following ways:
$ Svn help
Know the sub-command, but do not know the usage of sub-commands, you can also check:
$ Svn help add
Developers commonly used commands
(1) into the project
$ Cd ~ / Project
$ mkdir-P svntest / {trunk, branches, tags}
$ svn import svntest https://localhost/test/svntest-Message "Start Project"
...
$ RM-RF svntest
We create a new project svntest, in the three sub-projects under the New: trunk, development trunk; branches, development branch; tags, labels the development stage. Then imported into the repository under test, then svntest removed.
(2) export project
$ Svn checkout https://localhost/test/svntest/trunk
Revision number of the prescribed manner every developer must know, here are a few reference examples refer to svn recommendation.
$ Svn diff-Revision PREV: COMMITTED foo.c
# shows the Last Change committed to foo.c
$ Svn log-Revision HEAD
# shows log for the latest Repository commit Message
$ Svn diff-Revision HEAD
# Compares your Working file (with local changes) to the latest Version
# in the Repository
$ Svn diff-Revision BASE: HEAD foo.c
# Compares your "Pristine" foo.c (no local changes) with the
# latest Version in the Repository
$ Svn log-Revision BASE: HEAD
# shows All commit logs since you Last Updated
$ Svn Update-Revision PREV foo.c
# rewinds the Last Change on foo.c
# (foo.c 'S Working Revision is decreased)
$ Svn Checkout-Revision 3
Revision number # specified with
$ Svn Checkout-Revision {2002-02-17}
$ svn {15:30} Checkout-Revision
-Revision $ svn Checkout {15:30:00.200000}
$ svn Checkout-Revision {"2002-02-17 15:30" }
$ svn Checkout-Revision {"2002-02-17 15:30 +0230"}
$ svn Checkout-Revision {2002-02-17T15: 30}
$ svn Checkout-Revision {2002-02-17T15: 30z}
$ svn Checkout-Revision {2002-02-17T15 :30-04: 00}
$ svn 20020217T1530} {Checkout-Revision
-Revision $ svn Checkout 20020217T1530Z} {
$ svn Checkout-Revision-0500} {20020217T1530
(3) daily instruction
$ Svn update
$ Svn add foo.file
$ svn add foo1.dir
$ svn add non-recursive foo2.dir-
DELETE README $ svn
$ svn Copy foo bar
$ svn move foo1 bar1
$ Svn status
$ svn status-verbose
$ svn status-verbose-Show-Updates
$ svn status Stuff / fox.c
$ Svn diff
$ svn diff> patchfile
$ Svn revert README
$ svn revert
Modify the conflict, it will generate three files:. Mine,. ROLDREV,. RNEWREV. For example:
$ Ls-L
sandwich.txt
sandwich.txt.mine
sandwich.txt.r1
sandwich.txt.r2
One way to solve modify conflicts: modified file conflict sandwich.txt, then run the command:
$ Svn resolved sandwich.txt
The second way: a new version of the cover with a library of your changes:
$ Cp sandwich.txt.r2 sandwich.txt
$ svn resolved sandwich.txt
The third way: remove your changes, resolved in this way do not need to run sub commands:
$ Svn revert sandwich.txt
Reverted 'sandwich.txt'
$ ls sandwich .*
sandwich.txt
Sure no problem, you can submit a.
$ Svn commit-Message "Correct some fatal problems"
$ svn commit-file logmsg
$ svn commit
(4) test version of history
$ Svn log
$ svn log-Revision 5:19
$ svn log foo.c
$ svn log-v-R 8
$ Svn diff
$ svn diff-Revision 3 rules.txt
$ svn diff-Revision 2:3 rules.txt
$ svn diff-Revision 4:5 http://svn.red-bean.com/repos/example/trunk/text / rules.txt
$ Svn cat-Revision 2 rules.txt
$ svn cat-Revision 2 rules.txt> rules.txt.v2
$ Svn List http://svn.collab.net/repos/svn
$ svn-verbose http://svn.collab.net/repos/svn List
$ Svn Checkout-Revision 1729 # Checks out a new Working Copy at r1729
...
$ svn Revision 1729 Update-# Updates an existing Working Copy to r1729
...
(5) Other useful commands
svn cleanup
For the failed transaction cleared.
(6), branching and merging
The establishment of branch one: first, checkout and then make copies, and submit copies.
$ Svn Checkout http://svn.example.com/repos/calc bigwc
A bigwc / trunk /
A bigwc / trunk / Makefile
A bigwc / trunk / integer.c
A bigwc / trunk / button.c
A bigwc / branches /
Checked out revision 340.
$ Cd bigwc
$ svn Copy trunk branches / My-calc-Branch
$ svn status
A + branches / My-calc-Branch
$ Svn commit-M "Creating a private Branch of / calc / trunk."
Adding branches / My-calc-Branch
Committed Revision 341.
Establish a branch Method Two: Direct remote copy.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Creating a Branch of private / calc / trunk. "
Committed revision 341.
The establishment of a branch, you can checkout the branch and continue your development.
$ Svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
Suppose you have a trunk checkout, and now want to switch to a branch of development, do the following operations:
$ Cd calc
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/trunk
$ svn Switch http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
Updated to Revision 341.
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/branches/my-calc-branch
Merge file command reference:
$ Svn diff-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn MERGE-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn commit - M "integer.c: ported r344 (Spelling fixes) from trunk."
MERGE $ svn-R 343:344 http://svn.example.com/repos/calc/trunk My-calc-Branch
$ svn MERGE http:/ / svn.example.com/repos/branch1 @ 150 \
http://svn.example.com/repos/branch2 @ 212 \
My-Working-Copy
$ svn MERGE-R 100:200 http://svn.example. COM / repos / trunk-Working-Copy My
$ svn-R 100:200 http://svn.example.com/repos/trunk MERGE
MERGE-Dry $ svn-run-R 343:344 http://svn.example .com / repos / calc / trunk
The last command is just to do the merger test does not perform a merge operation.
Create a label and the establishment of a branch no difference, but just copying to a different directory.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-M "Tagging the 1.0 Release of the 'calc 'project. "
$ Ls
-My-Working Copy /
Copy My $ svn-Working-Copy http://svn.example.com/repos/calc/tags/mytag
Committed Revision 352.
The latter directly to the local working copy of the copy for the label.
In addition, you can delete a branch.
$ Svn DELETE http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Removing OBSOLETE Branch of calc Project."
Management of common commands
(7) repository management
$ Svnadmin Help
...
$ svnadmin Help create
...
$ svnadmin create-FS-type BDB / usr / local / Repository / svn / Test
$ chown-R svn.svn / usr / local / Repository / svn / Test
The establishment of the repository, the library type bdb (Berkeley DB to do with storage), database name is test.
svn repository has two storage methods: based on Berkeley DB (bdb) or file-based system (fsfs), by-fs-type can be specified storage.
(8) queries the repository information
$ Svnlook Help
...
$ svnlook Help Tree
...
Tree $ svnlook / usr / local / Repository / svn / Test-Show-IDS
bash> svn help
usage: svn[Options] [args]
Subversion command line client, version 1.2.0.
Please use the "svn help"Show the help sub-commands.
Most of the sub command file or directory acceptable parameters, recursive directory access.
without specifying parameters to the command, the default will be from the current directory (included) into the
line recursive access .
Available subcommands: (in brackets the abbreviated sub-commands)
add
blame (praise, annotate, Ann)
cat
Checkout (co) / / remove the library from the source copy of a working version of the
cleanup / /
commit (CI) / / submit the current working copy changes. This place is a possible code conflict.
copy (cp) / / make a working copy of the copy.
delete (del, remove, rm) / / delete local or svn server response on the file or directory.
diff (di) / / compare a file in the library corresponds to a different file, similar to the system's diff command. Parameters: the file name.
export / / export a directory tree without version control copy. Generally used for export distribution, or operational version.
Help (?, H)
import / / the local current directory in the file into svn response.
info / / current directory in your working copy of a file (folder) information, such as URL, version, date modified. Parameters: see the file (folder)
List (ls) / / list files under the current working copy, the equivalent of the system ls command, but can only be used in the working copy directory.
lock
log
MERGE / / The difference between the two sources applied to a working copy path.
mkdir / / local or svn respon create a new folder on the Parameters: URL or path to
move (mv, Rename, ren)
propdel (pdel, PD)
propedit (pedit, PE)
propget (pget, pg)
proplist (plist, PL )
propset (psets, PS)
resolved
revert
status (Stat, st) / / svn working copy of the current state of the source with svn server on the results of the comparison.
Switch (SW)
unlock
Update (up) / / sync the svn server-side files to the local
Subversion is a version control system tools.
To obtain more information, please refer to http://subversion.tigris.org/
> Svn co
Checkout (co): Check out a Working Copy from a Repository.
usage: Checkout URL [@ REV] ... [PATH]
If specified, REV determines in which the URL Revision is first
looked up.
If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a Sub-Directory of PATH, with the name of the Sub-Directory
being the basename of the URL.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read from directory ARG take the user profile
-ignore-externals: ignore externals definitions
SH> svn add
add: files and directories into the version control,
through the dispatch added to archive. They will join the next submission.
Usage: add path ...
Valid options:
-targets arg: pass contents of file ARG as an attachment parameter
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-config-dir arg: from the directory ARG read user configuration files
-force: force operation to run
-auto-props: enable automatic properties and effective
-no-auto-props: enable automatic properties invalid
eg. (The following command must be run in a working copy)
SH> svn add test.c / / add a file
sh> svn add test / / add a directory, the directory structure under any folder
sh> svn import http://localhost/svn/hehehehehhe-m = sdfsdf / / can be in any directory under the current folder so the files recursively into svn response of hehehhhe directory.
SH> svn export
export: to produce a free copy of version control tree.
Usage: 1, export [-R REV] URL [@ PEGREV] [PATH]
2, export [-R REV] PATH1 [@ PEGREV] [PATH2]
1, from the URL specified archive, export a clean directory tree to PATH. If specified
, then REV, content is the revised version, otherwise it is the HEAD revision. If PATH
is omitted, the address (URL) of the last part will be used as a local directory name.
2, in the working copy from a designated PATH1 export a clean directory tree to PATH2. If
REV is specified, then, will be derived from the specified revision, or derived from WORKING. If
PATH2 is omitted, PATH1 the final part will be used as a local directory name.
If REV is not specified, then all the local modifications will be maintained, but not included in the
version control file is not copied.
If you specify PEGREV, starting from the revision specified search.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-force: force operation to run
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the directory ARG file
-native-eol arg: use a different EOL marker is the standard
file system flag is a local svn: eol-style properties.
ARG may look at one of the 'LF', 'CR', 'CRLF'
-ignore-externals: ignore externals definitions
eg.
SH> svn export http://localhost/svn/hehehehehhhe
SH> svn MERGE
MERGE: the difference between the two sources applied to a working copy path.
Usage: 1, MERGE sourceURL1 [@ N] sourceURL2 [@ M] [WCPATH]
2, N sourceWCPATH2 MERGE sourceWCPATH1 @ @ M [WCPATH]
3, R MERGE-N: M SOURCE [@ REV] [WCPATH]
1, the first form, the source URL is assigned to the revision of the N and M. This is a two
more sources. If the revision is not specified, then defaults to HEAD.
2, in the second form, corresponding to two sources working copy paths define the URL for
the source of comparison. Revision must be specified here.
3, the third form, SOURCE can be a URL or working copy item, which will use the corresponding
address (URL). In the revised version of the REV of the address (URL) will it exist in the revision to the path of N and M for
comparison. If not specified, REV, will be assumed to HEAD.
WCPATH is acceptable to change the working copy path. WCPATH if omitted, the default value
',' unless the principal source of the name in line with '' in a file; In this case, the file
will be directly applied to the difference file to.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-force: force operation to run
-dry-run: try operation but does not modify
-diff3-cmd arg: use ARG as merge command
-ignore-ancestry: the merger of ignoring the original information
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the file directory ARG
$ Svn help
Know the sub-command, but do not know the usage of sub-commands, you can also check:
$ Svn help add
Developers commonly used commands
(1) into the project
$ Cd ~ / Project
$ mkdir-P svntest / {trunk, branches, tags}
$ svn import svntest https://localhost/test/svntest-Message "Start Project"
...
$ RM-RF svntest
We create a new project svntest, in the three sub-projects under the New: trunk, development trunk; branches, development branch; tags, labels the development stage. Then imported into the repository under test, then svntest removed.
(2) export project
$ Svn checkout https://localhost/test/svntest/trunk
Revision number of the prescribed manner every developer must know, here are a few reference examples refer to svn recommendation.
$ Svn diff-Revision PREV: COMMITTED foo.c
# shows the Last Change committed to foo.c
$ Svn log-Revision HEAD
# shows log for the latest Repository commit Message
$ Svn diff-Revision HEAD
# Compares your Working file (with local changes) to the latest Version
# in the Repository
$ Svn diff-Revision BASE: HEAD foo.c
# Compares your "Pristine" foo.c (no local changes) with the
# latest Version in the Repository
$ Svn log-Revision BASE: HEAD
# shows All commit logs since you Last Updated
$ Svn Update-Revision PREV foo.c
# rewinds the Last Change on foo.c
# (foo.c 'S Working Revision is decreased)
$ Svn Checkout-Revision 3
Revision number # specified with
$ Svn Checkout-Revision {2002-02-17}
$ svn {15:30} Checkout-Revision
-Revision $ svn Checkout {15:30:00.200000}
$ svn Checkout-Revision {"2002-02-17 15:30" }
$ svn Checkout-Revision {"2002-02-17 15:30 +0230"}
$ svn Checkout-Revision {2002-02-17T15: 30}
$ svn Checkout-Revision {2002-02-17T15: 30z}
$ svn Checkout-Revision {2002-02-17T15 :30-04: 00}
$ svn 20020217T1530} {Checkout-Revision
-Revision $ svn Checkout 20020217T1530Z} {
$ svn Checkout-Revision-0500} {20020217T1530
(3) daily instruction
$ Svn update
$ Svn add foo.file
$ svn add foo1.dir
$ svn add non-recursive foo2.dir-
DELETE README $ svn
$ svn Copy foo bar
$ svn move foo1 bar1
$ Svn status
$ svn status-verbose
$ svn status-verbose-Show-Updates
$ svn status Stuff / fox.c
$ Svn diff
$ svn diff> patchfile
$ Svn revert README
$ svn revert
Modify the conflict, it will generate three files:. Mine,. ROLDREV,. RNEWREV. For example:
$ Ls-L
sandwich.txt
sandwich.txt.mine
sandwich.txt.r1
sandwich.txt.r2
One way to solve modify conflicts: modified file conflict sandwich.txt, then run the command:
$ Svn resolved sandwich.txt
The second way: a new version of the cover with a library of your changes:
$ Cp sandwich.txt.r2 sandwich.txt
$ svn resolved sandwich.txt
The third way: remove your changes, resolved in this way do not need to run sub commands:
$ Svn revert sandwich.txt
Reverted 'sandwich.txt'
$ ls sandwich .*
sandwich.txt
Sure no problem, you can submit a.
$ Svn commit-Message "Correct some fatal problems"
$ svn commit-file logmsg
$ svn commit
(4) test version of history
$ Svn log
$ svn log-Revision 5:19
$ svn log foo.c
$ svn log-v-R 8
$ Svn diff
$ svn diff-Revision 3 rules.txt
$ svn diff-Revision 2:3 rules.txt
$ svn diff-Revision 4:5 http://svn.red-bean.com/repos/example/trunk/text / rules.txt
$ Svn cat-Revision 2 rules.txt
$ svn cat-Revision 2 rules.txt> rules.txt.v2
$ Svn List http://svn.collab.net/repos/svn
$ svn-verbose http://svn.collab.net/repos/svn List
$ Svn Checkout-Revision 1729 # Checks out a new Working Copy at r1729
...
$ svn Revision 1729 Update-# Updates an existing Working Copy to r1729
...
(5) Other useful commands
svn cleanup
For the failed transaction cleared.
(6), branching and merging
The establishment of branch one: first, checkout and then make copies, and submit copies.
$ Svn Checkout http://svn.example.com/repos/calc bigwc
A bigwc / trunk /
A bigwc / trunk / Makefile
A bigwc / trunk / integer.c
A bigwc / trunk / button.c
A bigwc / branches /
Checked out revision 340.
$ Cd bigwc
$ svn Copy trunk branches / My-calc-Branch
$ svn status
A + branches / My-calc-Branch
$ Svn commit-M "Creating a private Branch of / calc / trunk."
Adding branches / My-calc-Branch
Committed Revision 341.
Establish a branch Method Two: Direct remote copy.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Creating a Branch of private / calc / trunk. "
Committed revision 341.
The establishment of a branch, you can checkout the branch and continue your development.
$ Svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
Suppose you have a trunk checkout, and now want to switch to a branch of development, do the following operations:
$ Cd calc
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/trunk
$ svn Switch http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
Updated to Revision 341.
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/branches/my-calc-branch
Merge file command reference:
$ Svn diff-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn MERGE-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn commit - M "integer.c: ported r344 (Spelling fixes) from trunk."
MERGE $ svn-R 343:344 http://svn.example.com/repos/calc/trunk My-calc-Branch
$ svn MERGE http:/ / svn.example.com/repos/branch1 @ 150 \
http://svn.example.com/repos/branch2 @ 212 \
My-Working-Copy
$ svn MERGE-R 100:200 http://svn.example. COM / repos / trunk-Working-Copy My
$ svn-R 100:200 http://svn.example.com/repos/trunk MERGE
MERGE-Dry $ svn-run-R 343:344 http://svn.example .com / repos / calc / trunk
The last command is just to do the merger test does not perform a merge operation.
Create a label and the establishment of a branch no difference, but just copying to a different directory.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-M "Tagging the 1.0 Release of the 'calc 'project. "
$ Ls
-My-Working Copy /
Copy My $ svn-Working-Copy http://svn.example.com/repos/calc/tags/mytag
Committed Revision 352.
The latter directly to the local working copy of the copy for the label.
In addition, you can delete a branch.
$ Svn DELETE http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Removing OBSOLETE Branch of calc Project."
Management of common commands
(7) repository management
$ Svnadmin Help
...
$ svnadmin Help create
...
$ svnadmin create-FS-type BDB / usr / local / Repository / svn / Test
$ chown-R svn.svn / usr / local / Repository / svn / Test
The establishment of the repository, the library type bdb (Berkeley DB to do with storage), database name is test.
svn repository has two storage methods: based on Berkeley DB (bdb) or file-based system (fsfs), by-fs-type can be specified storage.
(8) queries the repository information
$ Svnlook Help
...
$ svnlook Help Tree
...
Tree $ svnlook / usr / local / Repository / svn / Test-Show-IDS
bash> svn help
usage: svn[Options] [args]
Subversion command line client, version 1.2.0.
Please use the "svn help"Show the help sub-commands.
Most of the sub command file or directory acceptable parameters, recursive directory access.
without specifying parameters to the command, the default will be from the current directory (included) into the
line recursive access .
Available subcommands: (in brackets the abbreviated sub-commands)
add
blame (praise, annotate, Ann)
cat
Checkout (co) / / remove the library from the source copy of a working version of the
cleanup / /
commit (CI) / / submit the current working copy changes. This place is a possible code conflict.
copy (cp) / / make a working copy of the copy.
delete (del, remove, rm) / / delete local or svn server response on the file or directory.
diff (di) / / compare a file in the library corresponds to a different file, similar to the system's diff command. Parameters: the file name.
export / / export a directory tree without version control copy. Generally used for export distribution, or operational version.
Help (?, H)
import / / the local current directory in the file into svn response.
info / / current directory in your working copy of a file (folder) information, such as URL, version, date modified. Parameters: see the file (folder)
List (ls) / / list files under the current working copy, the equivalent of the system ls command, but can only be used in the working copy directory.
lock
log
MERGE / / The difference between the two sources applied to a working copy path.
mkdir / / local or svn respon create a new folder on the Parameters: URL or path to
move (mv, Rename, ren)
propdel (pdel, PD)
propedit (pedit, PE)
propget (pget, pg)
proplist (plist, PL )
propset (psets, PS)
resolved
revert
status (Stat, st) / / svn working copy of the current state of the source with svn server on the results of the comparison.
Switch (SW)
unlock
Update (up) / / sync the svn server-side files to the local
Subversion is a version control system tools.
To obtain more information, please refer to http://subversion.tigris.org/
> Svn co
Checkout (co): Check out a Working Copy from a Repository.
usage: Checkout URL [@ REV] ... [PATH]
If specified, REV determines in which the URL Revision is first
looked up.
If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a Sub-Directory of PATH, with the name of the Sub-Directory
being the basename of the URL.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read from directory ARG take the user profile
-ignore-externals: ignore externals definitions
SH> svn add
add: files and directories into the version control,
through the dispatch added to archive. They will join the next submission.
Usage: add path ...
Valid options:
-targets arg: pass contents of file ARG as an attachment parameter
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-config-dir arg: from the directory ARG read user configuration files
-force: force operation to run
-auto-props: enable automatic properties and effective
-no-auto-props: enable automatic properties invalid
eg. (The following command must be run in a working copy)
SH> svn add test.c / / add a file
sh> svn add test / / add a directory, the directory structure under any folder
sh> svn import http://localhost/svn/hehehehehhe-m = sdfsdf / / can be in any directory under the current folder so the files recursively into svn response of hehehhhe directory.
SH> svn export
export: to produce a free copy of version control tree.
Usage: 1, export [-R REV] URL [@ PEGREV] [PATH]
2, export [-R REV] PATH1 [@ PEGREV] [PATH2]
1, from the URL specified archive, export a clean directory tree to PATH. If specified
, then REV, content is the revised version, otherwise it is the HEAD revision. If PATH
is omitted, the address (URL) of the last part will be used as a local directory name.
2, in the working copy from a designated PATH1 export a clean directory tree to PATH2. If
REV is specified, then, will be derived from the specified revision, or derived from WORKING. If
PATH2 is omitted, PATH1 the final part will be used as a local directory name.
If REV is not specified, then all the local modifications will be maintained, but not included in the
version control file is not copied.
If you specify PEGREV, starting from the revision specified search.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-force: force operation to run
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the directory ARG file
-native-eol arg: use a different EOL marker is the standard
file system flag is a local svn: eol-style properties.
ARG may look at one of the 'LF', 'CR', 'CRLF'
-ignore-externals: ignore externals definitions
eg.
SH> svn export http://localhost/svn/hehehehehhhe
SH> svn MERGE
MERGE: the difference between the two sources applied to a working copy path.
Usage: 1, MERGE sourceURL1 [@ N] sourceURL2 [@ M] [WCPATH]
2, N sourceWCPATH2 MERGE sourceWCPATH1 @ @ M [WCPATH]
3, R MERGE-N: M SOURCE [@ REV] [WCPATH]
1, the first form, the source URL is assigned to the revision of the N and M. This is a two
more sources. If the revision is not specified, then defaults to HEAD.
2, in the second form, corresponding to two sources working copy paths define the URL for
the source of comparison. Revision must be specified here.
3, the third form, SOURCE can be a URL or working copy item, which will use the corresponding
address (URL). In the revised version of the REV of the address (URL) will it exist in the revision to the path of N and M for
comparison. If not specified, REV, will be assumed to HEAD.
WCPATH is acceptable to change the working copy path. WCPATH if omitted, the default value
',' unless the principal source of the name in line with '' in a file; In this case, the file
will be directly applied to the difference file to.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-force: force operation to run
-dry-run: try operation but does not modify
-diff3-cmd arg: use ARG as merge command
-ignore-ancestry: the merger of ignoring the original information
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the file directory ARG
svn migration
SVN migration may be many reasons, may be we want to change Repository directory, or would like to replace the machine, and so on.
SVN migration is very easy to do, follow these steps can be:
SVN migration is very easy to do, follow these steps can be:
1. The original export a file dumpfile Repository
> Svnadmin dump path / to / old-repo> dumpfile
> Svnadmin dump path / to / old-repo> dumpfile
2 Create a new Repository, refer to the Windows platform to create ways to install Subversion Server
3. dumpfile into the new Repository
> svnadmin Load path / to / new-repo
3. dumpfile into the new Repository
> svnadmin Load path / to / new-repo
4 checking for new Repository in the conf / directory of configuration files, check the hooks / directory structure subroutine, etc. ...
The rapid migration of native way SVN:
svnadmin hotcopy old_rep_path new_rep_path
svnadmin hotcopy old_rep_path new_rep_path
Crack mysql root password in several ways
Several popular online crack mysql root password in several ways:
Method One
use phpmyadmin, this is the easiest, and modify the mysql user table, but do not forget to use the PASSWORD function.
Method Two
used mysqladmin, which is a special case of the previous declarations.
mysqladmin-u root-p password mypasswd
enter this command, you need to enter the root of the original password, and then the root password will be changed to mypasswd.
The command in the root to your user name, you can change your own password.
Of course, if your connection is not on mysqladmin mysql server, or you do not implement mysqladmin, then this method is ineffective, and not the mysqladmin password empty.
The following methods are in the mysql prompt, and must have mysql's root permissions:
Method Three
MySQL> Insert INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit ' ));
MySQL> FLUSH PRIVILEGES
Rather it is to add a user, the user name jeffrey, the password for the biscuit.
In the "mysql reference manual in Chinese," there are the examples, so I will write out.
Note To use the PASSWORD function, and then also use the FLUSH PRIVILEGES.
Method four
and three different methods, but use the REPLACE statement,
MySQL> REPLACE INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit '));
MySQL> FLUSH PRIVILEGES
Method Five
using the SET PASSWORD statement,
MySQL> SET PASSWORD FOR Jeffrey @ "% "= PASSWORD ('Biscuit');
to be used must also be PASSWORD () function, but do not use the FLUSH PRIVILEGES.
use phpmyadmin, this is the easiest, and modify the mysql user table, but do not forget to use the PASSWORD function.
Method Two
used mysqladmin, which is a special case of the previous declarations.
mysqladmin-u root-p password mypasswd
enter this command, you need to enter the root of the original password, and then the root password will be changed to mypasswd.
The command in the root to your user name, you can change your own password.
Of course, if your connection is not on mysqladmin mysql server, or you do not implement mysqladmin, then this method is ineffective, and not the mysqladmin password empty.
The following methods are in the mysql prompt, and must have mysql's root permissions:
Method Three
MySQL> Insert INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit ' ));
MySQL> FLUSH PRIVILEGES
Rather it is to add a user, the user name jeffrey, the password for the biscuit.
In the "mysql reference manual in Chinese," there are the examples, so I will write out.
Note To use the PASSWORD function, and then also use the FLUSH PRIVILEGES.
Method four
and three different methods, but use the REPLACE statement,
MySQL> REPLACE INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit '));
MySQL> FLUSH PRIVILEGES
Method Five
using the SET PASSWORD statement,
MySQL> SET PASSWORD FOR Jeffrey @ "% "= PASSWORD ('Biscuit');
to be used must also be PASSWORD () function, but do not use the FLUSH PRIVILEGES.
Method six
GRANT ... IDENTIFIED BY statement using the
MySQL> GRANT USAGE ON *.* TO Jeffrey @ "% "IDENTIFIED BY 'Biscuit';
Here PASSWORD () function is unnecessary and does not need to use the FLUSH PRIVILEGES.
GRANT ... IDENTIFIED BY statement using the
MySQL> GRANT USAGE ON *.* TO Jeffrey @ "% "IDENTIFIED BY 'Biscuit';
Here PASSWORD () function is unnecessary and does not need to use the FLUSH PRIVILEGES.
Note: PASSWORD () [not] to the Unix password encryption in the same way as the implementation of password encryption.
MySQL forgotten password solution
if MySQL is running, the first kill: killall-TERM mysqld.
Start MySQL: bin / safe_mysqld-skip-grant-tables &
you can access MySQL without a password.
Then is the
> use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
re-kill MySQL, use the normal way to start MySQL.
MySQL forgotten password solution
if MySQL is running, the first kill: killall-TERM mysqld.
Start MySQL: bin / safe_mysqld-skip-grant-tables &
you can access MySQL without a password.
Then is the
> use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
re-kill MySQL, use the normal way to start MySQL.
mysql password is empty
Windows:
1. with the system administrator login.
2 Stop the MySQL service.
3 into the command window, then enter the MySQL installation directory, for example, my installation directory is c: \ mysql, enter C: \ MySQL \ bin
4. Skip permission checks start MySQL,
c: \ MySQL \ bin> mysqld-NT -Skip-Grant-Tables
5. re-open a window into the c: \ mysql \ bin directory, set the root password for the new
c: \ MySQL \ bin> mysqladmin-u root flush-privileges password "newpassword"
c: \ MySQL \ bin> mysqladmin-u root-p shutdown
will newpassword replace the root password you want to use the second command will prompt you to enter a new password, repeat the first command typed password.
6 Stop MySQL Server, Mysql using normal mode
7. You can use the new password link to the Mysql up.
UNIX & Linux:
1. mysqld running with root or a user login system;
2. Use kill command to end off the mysqld process;
3. Use-skip-grant-tables parameter to start the MySQL Server
shell> mysqld_safe-Skip-Grant-Tables &
4. to root @ localhost new password
shell> mysqladmin-u root flush-privileges password "newpassword"
5. Restart MySQL Server
Windows:
1. with the system administrator login.
2 Stop the MySQL service.
3 into the command window, then enter the MySQL installation directory, for example, my installation directory is c: \ mysql, enter C: \ MySQL \ bin
4. Skip permission checks start MySQL,
c: \ MySQL \ bin> mysqld-NT -Skip-Grant-Tables
5. re-open a window into the c: \ mysql \ bin directory, set the root password for the new
c: \ MySQL \ bin> mysqladmin-u root flush-privileges password "newpassword"
c: \ MySQL \ bin> mysqladmin-u root-p shutdown
will newpassword replace the root password you want to use the second command will prompt you to enter a new password, repeat the first command typed password.
6 Stop MySQL Server, Mysql using normal mode
7. You can use the new password link to the Mysql up.
UNIX & Linux:
1. mysqld running with root or a user login system;
2. Use kill command to end off the mysqld process;
3. Use-skip-grant-tables parameter to start the MySQL Server
shell> mysqld_safe-Skip-Grant-Tables &
4. to root @ localhost new password
shell> mysqladmin-u root flush-privileges password "newpassword"
5. Restart MySQL Server
change password mysql
mysql changes in the mysql command line as follows:
MySQL-u root MySQL
MySQL> Update user SET password = PASSWORD ("new password") Where user = 'name';
MySQL> FLUSH PRIVILEGES;
MySQL> QUIT
mysql changes in the mysql command line as follows:
MySQL-u root MySQL
MySQL> Update user SET password = PASSWORD ("new password") Where user = 'name';
MySQL> FLUSH PRIVILEGES;
MySQL> QUIT
Teach you how to restore the MySQL database password
stored in the database because the MySQL password in the user table in mysql, so I only need to under windows 2003 user table in MySQL copied overwriting on the line.
In c: \ mysql \ data \ mysql \ (linux is generally / var / lib / mysql / mysql /) directory, there are three user table documents user.frm, user.MYD, user.MYI
user.frm / / user Table style file
user.MYD / / user table data file
user.MYI / / user table index file
for insurance purposes, the three are copied, but in fact, if you want to restore before that has not changed on the MySQL table structure, so long as copy user.MYD on the line
and then
stored in the database because the MySQL password in the user table in mysql, so I only need to under windows 2003 user table in MySQL copied overwriting on the line.
In c: \ mysql \ data \ mysql \ (linux is generally / var / lib / mysql / mysql /) directory, there are three user table documents user.frm, user.MYD, user.MYI
user.frm / / user Table style file
user.MYD / / user table data file
user.MYI / / user table index file
for insurance purposes, the three are copied, but in fact, if you want to restore before that has not changed on the MySQL table structure, so long as copy user.MYD on the line
and then
#. / Etc / rc.d / init.d / MySQL stop
#. / etc / rc.d / init.d / MySQL Start
# MySQL-u root-P XXXXXX
#. / etc / rc.d / init.d / MySQL Start
# MySQL-u root-P XXXXXX
Well, you can use windows 2003 landed under the mysql password
MySQL> use MySQL
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
To be wrong this time, suggesting that only read access to the user table
I analyze the reasons, just like this, because the user .* file permission assignment is under windows 2003, windows 2003, under the ls-l to see my permissions are 666
in linux Next I saw, after the authority becomes a copy over 600 (in fact, under normal circumstances, 600 on the line, but here the owner of the file is not mysql, copy after the owner came into the root, so there will be insufficient privileges, this time If you can change the permissions 666, and of course this is not good, does not solve the essence of the problem), in the / var / lib / mysql / mysql / ls-l looked at the next
re-
I analyze the reasons, just like this, because the user .* file permission assignment is under windows 2003, windows 2003, under the ls-l to see my permissions are 666
in linux Next I saw, after the authority becomes a copy over 600 (in fact, under normal circumstances, 600 on the line, but here the owner of the file is not mysql, copy after the owner came into the root, so there will be insufficient privileges, this time If you can change the permissions 666, and of course this is not good, does not solve the essence of the problem), in the / var / lib / mysql / mysql / ls-l looked at the next
re-
# Chown-R MySQL: MySQL user .*
# chmod 600 user .*
# chmod 600 user .*
/ / OK, DONE
weight from about MYSQL
reconnect
weight from about MYSQL
reconnect
MySQL> use MySQL
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> FLUSH PRIVILEGES;
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> FLUSH PRIVILEGES;
It is worth noting: If you are under windows mysql is the default configuration if so, attention should also perform
MySQL> DELETE from user where User = ";
MySQL> DELETE from user where Host ='%';
MySQL> FLUSH PRIVILEGES;
MySQL> DELETE from user where Host ='%';
MySQL> FLUSH PRIVILEGES;
Well, here the password recovery process is complete is a little bit what the limitations of this method, you must also have a separate user table file ###################### ################################################## ######## Other There are several ways to approach one another (this is a wider spread of the Internet means, mysql reference manual on the Chinese) 1 to the mysqld server to send the kill command to turn off the mysqld server (not kill - 9), the process ID of the file is usually stored in the MYSQL database directory.
killall-TERM mysqld
killall-TERM mysqld
You have to be UNIX root user or you are running SERVER on the same user to perform this operation.
2 Using `-skip-grant-tables' parameter to start mysqld. LINUX follows:
2 Using `-skip-grant-tables' parameter to start mysqld. LINUX follows:
/ Usr / bin / safe_mysqld-skip-grant-tables, windows, under c: \ mysql \ bin \ mysqld-skip-grant-tables
3 and no password to log on to mysqld server,
> Use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
. You can also do this:
`
mysqladmin-H hostname-u user password 'new password "
mysqladmin-H hostname-u user password 'new password "
4. Permissions table load:
`
mysqladmin-H hostname flush-privileges'
mysqladmin-H hostname flush-privileges'
Or use the SQL command
`FLUSH PRIVILEGES '
5.
killall-TERM mysqld
killall-TERM mysqld
6 with the new password to log ############################################ #################################### other methods two hex editor to directly edit the user. MYD file , but inside I want to illustrate this point, I've found a problem when editing, some of the encrypted password string is stored continuously, some of the last two were cut, stored in the back after the two other places. This I did not want to understand. there attention to the fact that editing is the encrypted password string, which means you still need another user table file. This method and my method described above difference is that this approach to directly edit files under linux user table, you do not need to re-change the file owner and permissions of the amendment this: I'm on Windows under the actual operation is as follows 1. shut down a running MySQL. 2 Open a DOS window, go to mysql \ bin directory. 3 Enter
mysqld-nt-skip-grant-tables
mysqld-nt-skip-grant-tables
Enter. If not prompted, you're right.
4. To open a DOS window (DOS window because that just has not moved), go to the mysql \ bin directory.
5 Enter the mysql Enter, if successful, the MySQL prompt>
6. permissions to the database connection
4. To open a DOS window (DOS window because that just has not moved), go to the mysql \ bin directory.
5 Enter the mysql Enter, if successful, the MySQL prompt>
6. permissions to the database connection
> Use MySQL;
(> prompt is already there, do not forget the final semicolon)
(> prompt is already there, do not forget the final semicolon)
6 to change the password:
> Update user set password = password ("123456") where user = "root"; (do not forget the final semicolon)
7. Refresh privileges (necessary steps)
> Flush privileges;
8 Exit
> \ Q
9 log off the system, re-entry, open MySQL, use the username root and password 123456 just set a new land.
It is said that can be used to directly modify the user table file approach:
turn off MySQL, Windows, open the Mysql \ data \ mysql, there are three files user.frm, user.MYD, user.MYI find know the password of MySQL, replace the corresponding three file, if the user did not turn over the table structure, usually no one to change, replace user.MYD it.
You can also directly edit user.MYD, find a hex editor, UltraEdit have this feature. Close MySQL, open user.MYD. Behind the user name of eight characters to root 565491d704013245, the new password is 123456. Or their corresponding hexadecimal numbers (on the left, where a character corresponding to the two numbers), to 0,002,020,202,020,202, which is an empty password, the editor the right to see an asterisk are *, looks like a decimal point. Reopen MySQL, enter root and your new password.
It is said that can be used to directly modify the user table file approach:
turn off MySQL, Windows, open the Mysql \ data \ mysql, there are three files user.frm, user.MYD, user.MYI find know the password of MySQL, replace the corresponding three file, if the user did not turn over the table structure, usually no one to change, replace user.MYD it.
You can also directly edit user.MYD, find a hex editor, UltraEdit have this feature. Close MySQL, open user.MYD. Behind the user name of eight characters to root 565491d704013245, the new password is 123456. Or their corresponding hexadecimal numbers (on the left, where a character corresponding to the two numbers), to 0,002,020,202,020,202, which is an empty password, the editor the right to see an asterisk are *, looks like a decimal point. Reopen MySQL, enter root and your new password.
MySQL-based learning
1, MySQL need to import and export individual data records?
- Where the pilot of the data table structure:
MySQL> create Table CHARBASE into outfile Show "/ DB / MySQL / RS.sql";
MySQL> create Table CHARBASE into outfile Show "/ DB / MySQL / RS.sql";
- Will need to export the contents stored in a separate text file, here we must note that the location must be stored in mysql user has rights position:
MySQL> SELECT * from CHARBASE order by CHARID DESC limit 15 into outfile "/ DB / MySQL / Record . SQL ";
- (note into outfile can only be used in select statement)
MySQL> SELECT * from CHARBASE order by CHARID DESC limit 15 into outfile "/ DB / MySQL / Record . SQL ";
- (note into outfile can only be used in select statement)
- Create the same table structure:
MySQL> create Database Test;
MySQL> Source RS.sql;
MySQL> create Database Test;
MySQL> Source RS.sql;
- The file data into the new database:
MySQL> LOAD DATA INFILE '/ DB / MySQL / record.sql' INTO TABLE CHARBASE;
MySQL> LOAD DATA INFILE '/ DB / MySQL / record.sql' INTO TABLE CHARBASE;
2, how to import and export the contents of a table?
- You can select the entire table of contents, with the load into!
- Mysqldump
- mysqldump-h127.0.0.1-uroot-P DBNAME TableName> table.sql
- Mysqldump
- mysqldump-h127.0.0.1-uroot-P DBNAME TableName> table.sql
3, how to backup and restore the whole database?
- Backup and restore MySQL database is the most simple thing, normally we do not need any tools, but to copy out the entire catalog can be! (Note, if it is best to migrate the server copy of mysql databases with the past.)
- finished in the copy rights as long as we can make a simple set:
- chown mysql.mysql / DB-R
- mysql.server restart
- but also you can use mysqldump to backup the entire database.
- mysqldump-h127.0.0.1-uroot-P DBNAME> table.sql
- finished in the copy rights as long as we can make a simple set:
- chown mysql.mysql / DB-R
- mysql.server restart
- but also you can use mysqldump to backup the entire database.
- mysqldump-h127.0.0.1-uroot-P DBNAME> table.sql
4, how to use mysql command to back up mysql database?
- If it is a small mysql database, of course, you can backup the entire database into a standard SQL script file, then restore.
- mysqldump-h127.0.0.1-uroot-P Test> / DB / MySQL / Test.sql;
- create Database test02;
- use test02;
- Source / DB / MySQL / Test.sql;
- mysqldump-h127.0.0.1-uroot-P Test> / DB / MySQL / Test.sql;
- create Database test02;
- use test02;
- Source / DB / MySQL / Test.sql;
5, how to export a database structure, but does not export any data?
- Mysqldump-h127.0.0.1-uroot-p-d RecordServer> / db / mysql / RecordServer.sql;
- Mysqldump-h127.0.0.1-uroot-p-d RecordServer> / db / mysql / RecordServer.sql;
6, how to view database, table, table structure, building form, building a database SQL script?
MySQL> Show Databases;
MySQL> Show Tables;
MySQL> DESC CHARBASE;
MySQL> Show create Table CHARBASE;
- mysqldump-h127.0.0.1-uroot-P-d RecordServer> / DB / MySQL / RecordServer.sql;
MySQL> Show Tables;
MySQL> DESC CHARBASE;
MySQL> Show create Table CHARBASE;
- mysqldump-h127.0.0.1-uroot-P-d RecordServer> / DB / MySQL / RecordServer.sql;
7, MySQL storage time and storage inside the field of IP addresses are usually converted wording, how to view their original format?
MySQL> SELECT CHARID, CREATEIP, CREATETIME, MAC, inet_ntoa (CREATEIP) AS IP, FROM_UNIXTIME (CREATETIME) AS TIME FROM CREATEIP WHERE CHARID = 13,566,952;
+----+----+----+--- ---+------+-------+
| CHARID | CREATEIP | CREATETIME | MAC | IP | TIME |
+----+----+----+-- ----+------+-------+
| 13,566,952 | 2,329,037,786 | 1208804488 | 176,940,240,538,368 | 138.210.75.218 | 2008-04-22 03:01:28 |
+----+ ----+----+------+------+-------+
[Note]: Here come the IP address is wrong, correct it should be reverse, such as the top right should be 218.75.210.138.
+----+----+----+--- ---+------+-------+
| CHARID | CREATEIP | CREATETIME | MAC | IP | TIME |
+----+----+----+-- ----+------+-------+
| 13,566,952 | 2,329,037,786 | 1208804488 | 176,940,240,538,368 | 138.210.75.218 | 2008-04-22 03:01:28 |
+----+ ----+----+------+------+-------+
[Note]: Here come the IP address is wrong, correct it should be reverse, such as the top right should be 218.75.210.138.
8, illustrates how to insert a table, modify or delete a field?
- Insert in a field:
MySQL> ALTER TABLE `RELATION` ADD `COUNTRYWARKILL` int (10) unsigned NOT NULL default '0 'after `ZEROCLEAR`;
MySQL> ALTER TABLE `RELATION` ADD `COUNTRYWARKILL` int (10) unsigned NOT NULL default '0 'after `ZEROCLEAR`;
- Insert the last field:
MySQL> ALTER TABLE `RELATION` ADD `COUNTRYWARKILL` int (10) unsigned NOT NULL default '0 ';
MySQL> ALTER TABLE `RELATION` ADD `COUNTRYWARKILL` int (10) unsigned NOT NULL default '0 ';
- Removing a field:
MySQL> Table CHARBASE ALTER DROP ZONE; or:
MySQL> ALTER COLUMN Table CHARBASE DROP ZONE;
MySQL> Table CHARBASE ALTER DROP ZONE; or:
MySQL> ALTER COLUMN Table CHARBASE DROP ZONE;
- Rename the field:
MySQL> ALTER Table CHARBASE Change ZONE not null default ZONE01 Integer '0 ';
MySQL> ALTER Table CHARBASE Change ZONE not null default ZONE01 Integer '0 ';
- How to rename a table
mysql> ALTER TABLE CHARBASE RENAME CHARNAME;
mysql> ALTER TABLE CHARBASE RENAME CHARNAME;
9, Linux terminals do not support the MySQL command mode to write Chinese, how to solve?
- Directly in the command execution:
MySQL-e "use RecordServer; SELECT CHARBASE.NAME, RELATION.COUNTRYWARKILL FROM CHARBASE, RELATION WHERE CHARBASE.COUNTRY = 4 AND CHARBASE.NAME LIKE 'ho MeN%'"
MySQL-e "use RecordServer; SELECT CHARBASE.NAME, RELATION.COUNTRYWARKILL FROM CHARBASE, RELATION WHERE CHARBASE.COUNTRY = 4 AND CHARBASE.NAME LIKE 'ho MeN%'"
- The update will update the Chinese name written statement to a text file, with the source to perform:
MySQL> Source / DB / MySQL / Test.sql;
MySQL> Source / DB / MySQL / Test.sql;
- Written in shell script:
# / bin / bash
MySQL-e "use RecordServer; UPDATE SET RELATION NAME = 'least powerful 2' WHERE CHARID = 15292694; UPDATE RELATION SET NAME = 'saliva, Mong Kok, Man 2' WHERE CHARID = 14771293 ; "
# / bin / bash
MySQL-e "use RecordServer; UPDATE SET RELATION NAME = 'least powerful 2' WHERE CHARID = 15292694; UPDATE RELATION SET NAME = 'saliva, Mong Kok, Man 2' WHERE CHARID = 14771293 ; "
- Direct execution:
MySQL-umysql-p123456-h192.168.1.50 RecordServer-e "INSERT INTO CHARBASE (ACCID, NAME) VALUES (85,164,210, 'Droney.zhao');"
MySQL-umysql-p123456-h192.168.1.50 RecordServer-e "INSERT INTO CHARBASE (ACCID, NAME) VALUES (85,164,210, 'Droney.zhao');"
10, how to insert a table, modify, delete operation?
- Inserts into the table:
MySQL> INSERT INTO CHARBASE (ACCID, NAME) VALUES (85,164,210, 'Droney');
MySQL> INSERT INTO CHARBASE (ACCID, NAME) VALUES (85,164,210, 'Droney');
- Clear the table:
MySQL> DELETE from COUNTRY;
MySQL> DELETE from COUNTRY;
- Delete some records in the table:
MySQL> DELETE FROM COUNTRY WHERE ID NOT IN (2,3,4,5,6);
MySQL> DELETE FROM COUNTRY WHERE NAME = 'Droney';
MySQL> DELETE FROM COUNTRY WHERE NAME like '% three Qinlang Zi%';
MySQL> DELETE FROM COUNTRY WHERE ID NOT IN (2,3,4,5,6);
MySQL> DELETE FROM COUNTRY WHERE NAME = 'Droney';
MySQL> DELETE FROM COUNTRY WHERE NAME like '% three Qinlang Zi%';
- Update some records in the table:
MySQL> UPDATE SET EXP = 500 COUNTRY WHERE ID IN (2,3,4,5,6);
MySQL> UPDATE SET EXP = 500 COUNTRY WHERE ID IN (2,3,4,5,6);
11, how to rename a table?
mysql> ALTER TABLE CHARBASE RENAME CHARNAME;
mysql> ALTER TABLE CHARBASE RENAME CHARNAME;
12, how to query field the same value of 1 records the number of users, will have such a record only the number of> 9 fields displayed?
SELECT CHARID, COUNT (*) FROM FRIEND WHERE WHICH = 1 GROUP BY CHARID HAVING COUNT (WHICH)> 9;
SELECT CHARID, COUNT (*) FROM FRIEND WHERE WHICH = 1 GROUP BY CHARID HAVING COUNT (WHICH)> 9;
13, how to modify the mysql user password?
MySQL> use MySQL;
MySQL> Update user set password = password ('123456 ') where user =' MySQL ';
MySQL> FLUSH PRIVILEGES;
or:
mysqladmin-h192.168.1.1-uusername-poldpassword password newpassword
MySQL> use MySQL;
MySQL> Update user set password = password ('123456 ') where user =' MySQL ';
MySQL> FLUSH PRIVILEGES;
or:
mysqladmin-h192.168.1.1-uusername-poldpassword password newpassword
- How to add, delete a MySQL user?
- Add the following method can be recommended, or use the above method to set permissions to add new users.
MySQL> INSERT INTO `user` VALUES ('192 .168.76.250 ',' Droney ', PASSWORD ('123456'), 'Y' , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ', ",", ",", '0', '0 ', '0' );
MySQL> FLUSH PRIVILEGES;
- Add the following method can be recommended, or use the above method to set permissions to add new users.
MySQL> INSERT INTO `user` VALUES ('192 .168.76.250 ',' Droney ', PASSWORD ('123456'), 'Y' , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ', ",", ",", '0', '0 ', '0' );
MySQL> FLUSH PRIVILEGES;
14, mysql user login password forget how to do or IP restrictions?
- Need to re-initialize the database.
su - dbadmin-c "/ usr / local / MySQL / bin / mysql_db_install"
su - dbadmin-c "/ usr / local / MySQL / bin / mysql_db_install"
mv / db / mysql / mysql / db / mysql / mysql_bak & & / usr / local / mysql / bin / mysql_db_install
chown mysql.mysql / db /-R & & mysql.server restart
15, how to view the mysql database code?
mysql> show variables like 'character_set_%';
mysql> show variables like 'character_set_%';
16, how to set up a table and insert a record?
MySQL> CREATE TABLE `serverlist` (
`ID` int (10) unsigned NOT NULL AUTO_INCREMENT,
`NAME` varchar (32) NOT NULL default ",
PRIMARY KEY (`ID`)
) ENGINE = MyISAM DEFAULT CHARSET = latin1;
MySQL> CREATE TABLE `serverlist` (
`ID` int (10) unsigned NOT NULL AUTO_INCREMENT,
`NAME` varchar (32) NOT NULL default ",
PRIMARY KEY (`ID`)
) ENGINE = MyISAM DEFAULT CHARSET = latin1;
mysql> INSERT INTO `SERVERLIST` VALUES (1, 'Droney');
17, how to set access permissions for MySQL?
- The following segment is set only allow 192.168.1.0 to connect, and add dbadmin user, password 123456, and delete all the mysql user password is blank.
MySQL> GRANT ALL PRIVILEGES ON *.* TO dbadmin @ '192 .168.1.% ' IDENTIFIED BY '123456 'WITH GRANT OPTION;
MySQL> DELETE from mysql.user where password = "";
MySQL> flush privileges;
MySQL> GRANT ALL PRIVILEGES ON *.* TO dbadmin @ '192 .168.1.% ' IDENTIFIED BY '123456 'WITH GRANT OPTION;
MySQL> DELETE from mysql.user where password = "";
MySQL> flush privileges;
- Other settings demonstration:
MySQL> Grant All on *.* to dbadmin @ localhost identified by 'password';
MySQL> Grant All on dbname .* to dbadmin @% identified by 'password';
MySQL> Grant SELECT, INSERT on dbname. tablename to dbadmin@192.168.1.% identified by 'password';
MySQL> Grant All on *.* to dbadmin @ localhost identified by 'password';
MySQL> Grant All on dbname .* to dbadmin @% identified by 'password';
MySQL> Grant SELECT, INSERT on dbname. tablename to dbadmin@192.168.1.% identified by 'password';
18, how to add, delete a MySQL user?
- Add the following method can be recommended, or use the above method to set permissions to add new users.
MySQL> INSERT INTO `user` VALUES ('192 .168.76.250 ',' Droney ', PASSWORD ('123456'), 'Y' , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ', ",", ",", '0', '0 ', '0' );
MySQL> FLUSH PRIVILEGES;
MySQL> INSERT INTO `user` VALUES ('192 .168.76.250 ',' Droney ', PASSWORD ('123456'), 'Y' , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ',' Y ', ",", ",", '0', '0 ', '0' );
MySQL> FLUSH PRIVILEGES;
19, if using mysqldump to export the data appears garbled how to do?
iconv-c-f UTF-8-t GB2312 library filename> file name of the new library
iconv-c-f UTF-8-t GB2312 library filename> file name of the new library
20, forgot the mysql password, I do not want to re-initial mysql database, how can I do?
- Kill the old mysql process, with the following command to start mysql, so mysql can not require a password, no IP restrictions are easily landed!
mysql> / usr / local / mysql / bin / mysqld_safe-skip-grant-tables &
mysql> / usr / local / mysql / bin / mysqld_safe-skip-grant-tables &
21, how to view build thread mysql:
MySQL> Show processlist;
MySQL> Show processlist;
22, other common statement:
mysql> status You can view the status mysql
mysql> tee history.txt operate after all in the mysql command will be stored in history.txt file;
mysql> notee; cancel the operation of the command into a file;
mysql> system clear; can call in mysql shell under the temporary file system commands to operate the system;
- Backup the entire database (to be simple and quick with a number of cp)
mysqldump-h192.168.1.1-uroot-P SuperServer> / SuperServer.sql;
mysqldump-h192.168.1.1-uroot-P SuperServer> / SuperServer.sql;
- Export the entire database structure
mysqldump-h192.168.1.1-uroot-p-d SuperServer> / SuperServer.sql;
mysqldump-h192.168.1.1-uroot-p-d SuperServer> / SuperServer.sql;
- Export table structure
mysql> show create table CHARBASE;
mysql> show create table CHARBASE;
- Export table structure and contents of
mysqldump-h192.168.1.1-uroot-p-d SuperServer CHARBASE> / SuperServer.sql;
mysqldump-h192.168.1.1-uroot-p-d SuperServer CHARBASE> / SuperServer.sql;
- Export table structure built script
mysql> show create table CHARBASE;
mysql> show create table CHARBASE;
- Results of a query directly to a file
mysql> select * from mysql.user into outfile 'aaa.sql';
mysql> select * from mysql.user into outfile 'aaa.sql';
23 to modify the table structure:
- Create a field NAME51, the location of the field after the move DSTZONE
SQL> ALTER TABLE `CHARBASE` add `NAME51` varchar (33) NOT NULL default ";
SQL> ALTER TABLE `CHARBASE NAME51` `` `Change` NAME51 varchar (33) NOT NULL default "AFTER` DSTZONE `;
SQL> ALTER TABLE `CHARBASE` add `NAME51` varchar (33) NOT NULL default ";
SQL> ALTER TABLE `CHARBASE NAME51` `` `Change` NAME51 varchar (33) NOT NULL default "AFTER` DSTZONE `;
24 Creating an index:
create index ID on TEMP (CHARID);
25 Advanced Query:
CREATE TABLE `C` (
`ID` varchar (100) NOT NULL default ",
`NAME` varchar (100) NOT NULL default "
) ENGINE = MyISAM DEFAULT CHARSET = latin1;
`ID` varchar (100) NOT NULL default ",
`NAME` varchar (100) NOT NULL default "
) ENGINE = MyISAM DEFAULT CHARSET = latin1;
update A, B set B. ID = A. ID where A.name = B.name;
insert into B (ID, NAME) select ID, NAME from A;
insert into B (ID, NAME, AGE) select ID, NAME, 25 from A;
insert into C (NAME) VALUES ('zhaohang'),(' zhouzhou'),(' xiaoxiao');
26 set by the field increment from the starting value:
Alter tableName auto_increment = 4000;
Subscribe to:
Posts (Atom)