Feed on
Subscription

The profit of the object is used in the database

Clearly,This data that to us control accesses an object has very great help.If a programmer has accessed the information of Username forthrightly,The code that will destroy him with the change that the previous generation piles up.However we can be used (kind) access a method,Resemble above of the annotate in code in that way,The function that adds a test and verify and do not need to change any other things.The test and verify that notices Username (it is to cannot exceed 12 byte among example) code is to be in independently besides SetUsername() method.Arrive to memory from test and verify the process of the database is easy to do.And,This is a first-rate sheet by the method of experience,A method or kind what need does is less,The opportunity that its repetition uses will be jumped over big.This is more apparent when you begin to write a subclass,If you need a subclass,And should have jumped again (oversight) father kind method (behavior) medium a few special detail,If (be aimed at this detail) the method is very small and careful,(revise it) it is flashy process only,And if this method unusual too fat to move,In the light of a variety of purposes,You will be in possibly in duplicate subclass in a large number of code depressed and eventually.

Say for example,If Admin is User kind a subclass.We may have to the user of Adamin different,Method of relatively a few more slashing password test and verify.Had better be to had crossed father kind method of test and verify and whole SetUsername() method (rescript in subclass) .

More about accessing implement (Accessor)
It is a few other case will explain how to make access below implement used more effective fruit.We should count a lot of time possibly result,is not the simple static data in returning array.A when access a method to still can be done useful thing is updated namely (Updating) the value in cache.Become all changing (all operations that logarithm occupies) when wanting to adopt SetX() method,This is we come according to X the hour of the value in replacement cache.

Then our this kind administrative levels becomes more clear:The processing of in-house and variable $_data is replaced the way of illicit in the right way that gets protection (Private Methods) _getData() and _setData() this kind of method is arrived to be called a record by move (Record) abstract super kind (Super Class) ,Of course it is User kind the subclass below is recorded this kind (Record Class) master all detail that access array $_data,In the method that test and verify calls before content is revised,And issue a record modificatory announcement (Records) ,Resemble sending central object memory (ObjectStore) example.
...

A few wants an attention issues of MySQL are handled in PHP

? to MySQL,The first each travel command that what you must remember well is it is to use semicolon (;) serves as an end,But... without completely very thing,Also be same here,When a MySQL is inserted to be in PHP code,Had better drop the semicolon from the back elliptically,For example:

...

MySQL platform database backs up plan defines

Below the circumstance that database watch is lost or damages,It is very important to back up your database is.If produce a system to break down,You think for certain can lose your watch least data to restore to break down as far as possible the condition when happening.Sometimes,Be MySQL administrator is caused destroy.The administrator has known the watch already was destroyed,Try to edit them directly with the editor such as such as Vi or Emacs,This is not a favour absolutely to the watch!

Backup database two main methods are to use Mysqldump program or document of direct copy database (if use Cp, Cpio or Tar,wait) .Every kinds of method has its actor drawback:
Mysqldump and MySQL server are operated in coordination.Direct copy method is in the server is exterior undertake,The watch that and you must take step assures to revising you to will be copied without the client.If you think with file system backup comes,back up database,Also can produce same question:If the database is expressed,be revised in process of file system backup,The condition with the watch file abhorrent subject that enters backup,And right the following restore a watch to will lose a sense.File system backup and the distinction that copy a file directly are pair of latter you controlled backup process completely,Such you can adopt measure to ensure the server lets a watch do not suffer interference.
Mysqldump wants than direct copy some slower.
Mysqldump is generated can transplant to the text file of other machine,Even on those machines that have different hardware structure.Direct copy file cannot transplant to other machine,Unless you are in,the watch of the copy uses MyISAM memory form.ISAM watch can be only on the machine of similar hardware structure copy.The form of MyISAM watch memory that introduces in MySQL 3.23 solved this problem,Because this format is a machine,have nothing to do,On the machine that so direct copy file can transplant to have different hardware structure.Should satisfy two requirements only:Another machine also must run MySQL 3.23 or later version,And the file must express with MyISAM format,is not ISAM format.

No matter you use method of which kinds of backup,If you need to restore a database,A few principles should be abided by,In order to ensure best result:

Fixed executive backup.Establish a plan and abide by strictly.

Let a server carry out newer daily record.When after you are breaking down, should needing to restore data,Newer daily record will help you.After restoring to count the state when backing up according to arriving with backup file in you,You can update the inquiry in the log to apply the modification at the back of backup again through moving,This restores the watch in the database to break down the condition when happening.

The term that backs up with file system is told,Database backup file represents complete tip (Full Dump) ,And newer daily record represents advance gradually tip (Incremental Dump) .

Use a kind to unite name a mechanism with intelligible backup file.Resembling Backup1, Buckup2 to wait is not particularly significant.When the refreshment that carries out you,You find out wasteful time is what thing in the file.You may detect to make backup file name with database name and date the meeting is very useful.For example:

%mysqldump Samp_db %26gt;/usr/archives/mysql/samp_db.1999-10-02

%mysqldump Menagerie %26gt;/usr/archives/mysql/menagerie.1999-10-02

You may want to compress them after generating backup.Backup is general very big!The backup document that you also need to let you has expire deadline in order to avoid their cram your disk,The log document that allows you just like you expires in that way.

With file system backup backs up your backup file.If was met,one breaks down thoroughly,Kept clear of not only your data catalog,The disk drive that the database that also kept clear of to include you backs up,You will meet a trouble truly.

Also should back up your newer daily record.

Put your backup document on the file system that is different from the database that is used at you.The possibility of the file system that because generate backup,this will be reduced and cram includes data list.

The technology that is used at founding backup arrives to copying a database likewise another machine is useful.The commonnest,The server that a database was gone to to move on another lead plane by move,But another server that you also can transfer same table lead plane to go up.

1 uses Mysqldump backup and copy database

When program of your use Mysqldumo generation database backs up when the file,Default ground,File content is included found the CREATE statement of the watch of dump and the INSERT statement that data goes in including a list.In other words,After the output that Mysqldump generates can be in, use as the input of Mysql will rebuild database.

You can receive whole database tip an alone text document in,As follows:

%mysqldump Samp_db %26gt;/usr/archives/mysql/samp_db.1999-10-02

The begin that outputs a file looks as if such:

# MySQL Dump 6.0# # Host: Localhost Database: Samp_db#-------------

--------------------------# Server Version 3.23.2-alpha-log## Table St
Ructure For Table Absence#CREATE TABLE Absence(Student_id Int(10)
Unsigned DEFAULT 0 NOT NULL, date Date DEFAULT 0000-00-00 NOT NUL

L, PRIMARY KEY (student_id, date));## Dumping Data For Table Absence

#INSERT INTO Absence VALUES (3, 1999-09-03);INSERT INTO Absence VALUE

S (5, 1999-09-03);INSERT INTO Absence VALUES (10, 1999-09-08); . . . . . .

The part that the file remains has more INSERT and composition of CREATE TABLE statement.

If you want to compress backup,Use similar the command that be as follows:

%mysqldump Samp_db | Gzip %26gt;/usr/archives/mysql/samp_db.1999-10-02.gz

If you want a giant database,Output a file also very will giant,The likelihood is hard to manage.If you are willing,The listed and alone watch name after the database name that you can go in Mysqldump command comes bend to their content,This divides dump file into lesser, more the file that manages easily.Next exemples show how to go to the bend of a few watches of Samp_db database in the document that submits departure:

%mysqldump Samp_db Student Score Event Absence %26gt;grapbook.sql

%mysqldump Samp_db Member President %26gt;hist-league.sql

If you generate preparation to be used at fixed refresh the backup file of another database content,You may want to use- - Add-drop-table option.This tells a server to keep statement of DROP TABLE IF EXISTS backup file,Next,When you take out backup file and lading it into the second database,If the watch has existed,You won't get an error.

If your teem so that a database can transfer the database to another server,You need not found backup file even.Should make sure data inventory depends on another lead plane,Pour a database with conduit bend next,Such Mysql can read the output that takes Mysqldump directly.For example:You want to copy database Samp_db from lead plane Pit-viper.snake.net to Boa.snake.net,Can accomplish very easily so:

%mysqladmin -h Boa.snake.net Create Samp_db

%mysqldump Samp_db | Mysql -h Boa.snake.net Samp_db

Later,If you think again the database on refresh Boa.snake.net,Jump over Mysqladmin to command,But should add to Mysqldump- - the error that Add-drop-table gets expressing already existinged with what avoid:

%mysqldump- - Add-drop-table Samp_db | Mysql -h Boa.snake.net Samp_db
The option with Mysqldump useful other includes:

- - Flush-logs and- - Lock-tables combination will examine a site to your database helpful.- - Lock-tables lock decides you to be in all watches of dump,And- - Flush-logs is shut and open file of newer daily record afresh,The inquiry that new newer daily record will include to nod the modification database since from backup only.The inspection of newer daily record that this will set you chooses a backup time.(if you have need,carry out an updated client however,The lock decides all watches is not a favour to backing up the client during is visited.)

If you are used- - when Flush-logs installs an examination to nod backup,Had better be dump likely whole database.

If your dump is alone file,Check the number of of check of worse will newer daily record and backup file synchronism.During restore,You update log content for fundamental extraction by the database normally,To the option that individual watch replaces without extraction,So you yourself must extract them.

Default ground,The whole content that Mysqldump expresses before be written is read into memory.This normally really needless,And if you have,actually one is expressed greatly,Be failure almost.You are usable- - Quick option tells Mysqldump to want it to retrieve a group to draw up only each.To optimize dump process further,Use- - Opt is not- - Quick.- - Opt option opens other option,The dump that quickens data and read them time.

With- - Opt carries out backup may be the most commonly used method,The advantage that goes up because of backup speed.However,Should warn you,- - Opt option has price really,- - the backup process that what Opt optimizes is you,Not be the other client visit to the database.- - Opt option decides all watches to prevent anybody to update you to be in through lock any watches of dump.You can see its effect very easily on general database visit.The database that becomes you is used often commonly,It is a day of ground adjustment backup only.

One is had- - the option of the adverse effect of Opt is- - Dedayed.This option makes Mysqldump draws up INSERT DELAYED statement is not INSERT statement.If you load data file another database and the impact that you think is the inquiry that this operation appears in this database to the likelihood is the least,- - Delayed is very helpful to this.

- - Compress option is copied in you when the database arrives on another machine very helpful,Because it reduces a network to transmit the amount of byte.There is a case below,Notice- - Compress just gives out to the program that with far end the server on lead plane corresponds,is not right with program of connective of this locality lead plane:

%mysqldump- - Opt Samp_db | Mysql- - Compress -h Boa.snake.net Samp_db
Mysqldump has a lot of option,Detailed sees " MySQL reference manual " .

2 uses the backup that copies a database directly and copy method

Another kind of kind that does not involve Mysqldump backup database and table is to copy a database to express a file directly.Typically,This uses such as Cp, Tar or Cpio utility program.The example of the article uses Cp.

When you use method of a kind of direct backup,You must make sure the watch is absent to be used.If the server is in,it is changed when you are copying a watch,The copy loses a sense.

The copies integrality best method that assures you is to shut a server,Copy file,Restart next server.If you do not want to shut a server,Should lock up while executive watch is checked decide a server.If the server is moving,Restrict identically also apply to copy file,And you should use identical lock to decide an agreement to let a server " quiet to come down " .

Hypothesis server is shut or you had locked up the watch that decided you to consider a copy,Following show how to back up backup of whole Samp_db database to catalog (the data list that DATADIR shows a server) :

%cd DATADIR%cp -r Samp_db /usr/archive/mysql

Individual watch can back up as follows:

%cd DATADIR/samp_db%cp Member. * /usr/archive/mysql/samp_db%cp Score. *

/ Usr/archive/mysql/samp_db. . . .

When you finished backup,You can restart server (if shut it) or release the lock that is added on the watch to decide (if you let a server move) .

Should use direct copy file to copy a database to another machine from a machine,Below the relevant data catalog that just copies the file another server lead plane can.Should ensure the file is MyIASM format or two machines have identical hardware structure,Otherwise your database has strange content on another lead plane.They are not visited when you also should assure the server on another machine to installing a database to express in you.

3 duplicate database (Replicating Database)

Duplicate (Replication) be similar to copy database to another server,But its precise meaning is the complete synchronism that assures two databases in real time.This function will appear in 3.23 edition,And very not mature still,Accordingly the article does not make detailed introduction.

4 restores data with backup

The happening that the database damages has a lot of reasons,Level is different also.If you are in good luck,You may damage two one are expressed only (if drop report) ,If you are hapless,You must replace whole data catalog possibly (if disk damages) .Also need to restore below certain circumstance,For instance the user deleted a database erroneously or express.No matter these having bad luck the reason of incident,You implement need some kind to restore.

If express attaint but did not lose,The attempt uses Myisamchk or Isamchk rehabilitate they,If such attaint can have repair program repair,You may need to use backup document far from.About expressing the process of repair,See " the database is safeguarded with repair " .

Restore a process to involve source of two kinds of news:Your backup file is mixed a newer daily record.The condition when backup file restores the watch to carry out backup,Express commonly however in backup and produce a problem had been revised inside the time between,Newer daily record included the inquiry that is used at undertaking these modification.The input that you can use log file to serve as Mysql will repeat inquiry.The reason that why should this already enable newer daily record just about.

The information that restores a process to inspect you to must restore how many and different.Actually,It is easy to restore whole database to follow than individual watch,It is easy to because use newer daily record to the database,compare individual list.

4.1 restores whole database

Above all,The Mysql database that if you think resumptive database is,includes accredit list,You need to use- - Skip-grant-table option runs a server.Otherwise,It can complain cannot find accredit to express.After you had restored to express,Executive Mysqladmin Flush-privileges tells a server to lade award mace and use them.

Copy database catalog content other a certain place,If you are in,need them later.

With database of newest backup file reshipment.If you use the document that Mysqldump produces,The input that regards Mysql as it.The file that if you are used,comes from database copy directly,them direct beat answers database catalog,However,The database is shut before right now you need to copying a file,Restart next it.

Use newer daily record to repeat make the inquiry that backs up the following modification database is expressed.To any adaptable update a daily record,The input that regards Mysql as them.Appoint- - One-database option makes Mysql carries out you to have fun at only the inquiry of resumptive database.If you know you need to use document of all newer daily record,You can use this order below the list that includes a daily record:

% Ls -t -r -1 Update. [0-9]* | Xargs Cat | Mysql- - One-database Db_name
A sheet that Ls command makes file of newer daily record lists list,The order sort that produces them according to the server (idea:If you alter any document,You will change sort order,This brings about newer daily record the order of one mistake is applied.)

Probable you can be to use some a few newer daily records.For example,Since the newer daily record that since you back up, produces be named to be Update.392, Update.393 to wait a moment,You can move afresh so:

%mysql- - One-database Db_name%26lt;Update.392

%mysql- - One-database Db_name%26lt;Update.393

. . . . .

If you are being carried out,restore and the DROP DATABASE that uses newer daily record to because a mistake suggests,restore, DROP TABLE or DELETE statement create missing news,Before using newer daily record,Should assure from delete these statements among them.

4.2 restores individual watch

Restore individual watch relatively complex.If you use a backup file that makes by Mysqldump,The data of the watch that and it does not include you is interested,Your need extracts them from inside relevant travel and use them as the input of Mysql.This is easy part.Hard part is help a segment from inside applying what express at this to update a daily record only.Utility program of Mysql_find_rows of your meeting disclosure is very helpful to this,It inquires all right more from the extraction in updating a daily record.

Another possibility is to use another server to restore whole database,The watch file that copies you to want next arrives in former database.This may be very easy really!When you answer file beat database catalog,Should ensure the server of former database is shut.

...

Root password was lost how to be made up for in MySQL

Losing a password is very distressed thing,Especially Root password was lost: (.Him outfit outfit plays lost also lost,But in case it is the server hanged a trouble but big!Now is as a result of the Root that is inbreaked to cause the password is lost suppose.I talk about myself to be opposite here the view of a such problems.Encounter this kind of problem above all we were not necessary flurried,Whole resuming a course also is very simple.

Source of MySQL of 1 download issues a package,Need not distinguish operating system,The thing that we need is same.

The Mysql folder below the Data catalog of the Mysql that 2 names him again is Oldmysql.

The Mysql list that 3 issues list of the Data in source bag duplicates below the Data catalog of your Mysql.

4 starts Mysql afresh,The accredit relation of Mysql is the same as now brand-new of installation same,Empty password is landed,Adjust accredit by oneself next.

5 opens Oldmysql this library examination appeared after all what problem.

If 6 has backup to undertake to database of some of systematic Central Plains integrality detects,Lest be revised.

Can have restored you completely through 6 afore-mentioned measure to the control of Mysql,The key is finally two paces check the other side to changing those attributive,And the integrality of data detects.

...

The biggest join in how increasing MYSQL is counted?

The acquiesce of number of the biggest join of Mysql is 100, the database application with this very much to intercurrent join numerical value is far insufficient,After should joining the request is more than acquiescent join to count,Can appear cannot join the mistake of the database,Accordingly we need to move it appropriately a few bigger,

Two kinds of method can revise the biggest join to count,One kind is modification Safe_mysqld,Another kind is to revise former code to be compiled afresh directly.We introduce these two kinds of methods respectively below:



1. revises Safe_mysqld


Find Safe_mysqld to edit it,Two that when find Mysqld to start,Parameter is added at the back:


- O Max_connections=1000


For example:(Among them in front have---The content that is before,And + + + it is to had been revised the following)


---Safe_mysqld.orig Mon Sep 25 09:34:01 2000


+ + + Safe_mysqld Sun Sep 24 16:56:46 2000


@@ -109, 10 +109, 10 @

If Test "$#" -eq 0

Then

Nohup $ledir/mysqld- - Basedir=$MY_BASEDIR_VERSION- - Datadir=$DATADIR


-- - Skip-locking %26gt;%26gt;$err_log 2%26gt;%26amp;1


+- - Skip-locking -O Max_connections=1000 %26gt;%26gt;$err_log 2%26gt;%26amp;1

Else

Nohup $ledir/mysqld- - Basedir=$MY_BASEDIR_VERSION- - Datadir=$DATADIR


-- - Skip-locking %26quot;$@%26quot; %26gt;%26gt;$err_log 2%26gt;%26amp;1


+- - Skip-locking %26quot;$@%26quot; -O Max_connections=1000 %26gt;%26gt;$err_log 2%26gt;%26amp;1

Fi

If Test! - F $pid_file # This Is Removed If Normal Shutdown

Then



Shut Mysql to restart next it,With


/ Mysqladmin is in method / Mysqladmin -uroot -p Variables



Input Root database can see after the password of Zhang date


| Max_connections | 1000 |


Namely new alter already become effective.



2. amends former code


The former code of unlock MySQL,Enter the Sql catalog inside to revise Mysqld.cc to find below group:


{"max_connections" , (Long*) %26amp;max_connections, 100, 1, 16384, 0, 1} ,


its instead:


{"max_connections" , (Long*) %26amp;max_connections, 1000, 1, 16384, 0, 1} ,


Save file to disk exit,Next. / Configure;make;make Install can achieve similar result.

...

Derive from inside SQL a of MYSQL simple method

Derive from Sql the method of Mysql is very much,Introduce a kind now need not process designing,The simple method that uses the graphical interface in Sql and Mysql to undertake guiding deriving directly.

Premise is the Phpmyadmin of tool of graphical interface government that had installed Sqlserver client end and Mysql.

Sqlserver business management is opened below console root catalog implement,Build Sqlserver group,Undertake choosing according to oneself circumstance;Build Sqlserver to register next,The link that has pair of Sqlserver.After preparation is proper,Began below:

Open data to change a service above all,Build a packet,Open DTS interface,In join choice data source undertakes configuration.The purpose file that reelection choose will change,The Textfile(destination) that I choose here,Choose good file after depositing the position,We will build a task.We choose to change data job only here,Will contain " choice source joins " " choice purpose joins " the mouse parts after source of pitch on data and purpose,The link that we become to the new student has a definition,In source of its attribute lieutenant general,Purpose,Change ordinal definition.

Executive task,Clew is successful.Save the job.Derive on newly-built task next data,Guide hints,Among them a choice " from source data library duplicate watch is mixed view " .

This one pace has derived data in purpose file.

Build a list in Mysql next,When keeping consistent with the structure that will guide,Choose directly " from data of the extraction in text file,Insert data to express:" ,After buying option," send " OK,Browse,Data already guided.If want the list that guides,had existed,And attribute name is different also,The list that builds an as identical as the data that should guide structure first at this moment guides data (by a moment ago it is OK to undertake) ,Derive in Mysql next " data and structure " ,Receive Sql sentence,In the editor in text file its,Use text editor replace a function,the watch the name is revised,Row name is joined,Finally its stickup wanting to guide the place of the executive Sql statement of the watch,Carry out,Data guided.

The mistake appears in be like a process,The option that asks microscope configuration,Ensure correct.

...

From compile a tool:Of a few kinds of Mysql optimize a method

One, Mysql ? is optimized when compile
If you distribute installation Mysql from source code,Should notice,The effect with compile a process to have to function of the following object program main,Compile means differently to may obtain similar target document,But function may differ very big,Because of this,Compiling installation Mysql to suit to choose carefully to compile option well the most possibly according to your applied type.This kind of custom-built Mysql can offer optimum behavior for your application.?
Skill:It is better to choose compile implement it is better to mix compile implement option,Such application can raise function 10-30% .(Mysql documentation says so) ?

1.1, use Pgcc (Pentium ? Gcc) is compiled implement ?
Should compile implement (Http://www.goof.com/pcg/ ) in the light of move in gallop the program on processor system undertakes optimizing,Compile Mysql source code with Pgcc,Overall performance can rise 10% .If your server is not to use,gallop of course processor,Need not use it,Because it is to be only,gallop the system designs.?

1.2, the character set that uses you to want to use only compiles Mysql ?The character set that Mysql looks premise differs for amounting to 24 kinds,The data in be inserted with the language of themselves for global user or examining a watch.Save a circumstance to fall however,Mysql installation is possessory these character set,Hot however,Best choice is to point to those who choose a kind of your need.Like,Prohibit removing all other character set beyond Latin1 character set:?
------------------------------------------------------------------------------?
%%26gt; . / Configure ? - With-extra-charsets=none ? [- - Other-configuration-options] ?
------------------------------------------------------------------------------?

1.3, compile Mysqld the static state to carry out file ?
Compile Mysqld the performance with the static state carries out a file and need not share a library to also can be obtained better.Through following options is being appointed when configuration,But the static state compiles Mysqld.?
------------------------------------------------------------------------------?
%%26gt; . / Configure ? - With-mysqld-ldflags=-all-static ? [- - Other-configuration-options] ?
------------------------------------------------------------------------------?

1.4, configuration example ?
Following configuration command is commonly used at improving performance:?
------------------------------------------------------------------------------?
%%26gt;cflags=%26quot;-o6 ? - Mpentiumpro ? - ? of Cxxflags=%26quot;-o6 of ? of Fomit-frame-pointer%26quot; ? Cxx=gcc - Mpentiumpro ? - Fomit-frame-pointer ? - Felide-constructors ? - Fno-exceptions ? - Fno-rtti%26quot; ? . / Configure ?- - Prefix=/usr/local ?- - Enable-assembler ?- - With-mysqld-ldflags=-all-static ?- - Disable-shared ?
------------------------------------------------------------------------------?

Two, adjust server ?
Ensure apply it is admittedly important to be compiled correctly,But the first pace that this just succeeds,The Mysql variable with numerous configuration is likewise right of the server run a crucial function normally.You can assign these variably existence configures a file in,With ensuring they all act well when starting Mysql every time,This configuration file is My.cnf file.?The example that Mysql had provided document of a few My.cnf,Can be in / find below Usr/local/mysqld/share/mysql/ catalog.These files name respectively for My-medium.cnf of My-small.cnf, ? , My-large.cnf and My-huge.cnf,Dimensions specification can configure a file in the description find in applicable systematic type caption.If be on the system that has quite little memory only,run Mysql,And just now and then with,So My-small.cnf will be idealer,Because it commands Mysqld uses least resource only.Similar,If you plan compose to establish supermarket of electronic business affairs,And the system has 2g memory,So you should use Mysql-huge.cnf document possibly.?
To use one of these files,You need to duplicate a file that fits requirement most,Incognito for My.cnf.You can choose a kind of limits of three kinds of action to use configuration document:?Global:Duplicate My.cnf file of the server / below Etc catalog,The variable action that this makes configuration file medium at overall situation,The Mysql database server that goes up to all servers namely is effective.
? Local:Duplicate My.cnf file [below Mysql-install-dir]/var/ catalog,Make My.cnf action at specific server.[Mysql-install-dir] states Mysql installs catalog.
? User:You can restrict action again at specific user,Duplicate My.cnf to fall to the root catalog of the user.?
These variable in how installing My.cnf after all?Say further,You can install which variable.Although what use variable relatively general to Mysql server,Of each variable and Mysql certain component has more specific concern.If variable Max_connects returns,fall in Mysqld category.Carry out following command to be able to know:?
------------------------------------------------------------------------------?
%%26gt;/usr/local/mysql/libexec/mysqld ?- - Help ?
------------------------------------------------------------------------------?
It shows many options and the variable related to Mysqld.You can be easily under word of this style or manner of writing find out variable:?
------------------------------------------------------------------------------?Option ? of ? of For of ? of Possible ? Variables- - Set-variable ? (- ? of O) ? Are
------------------------------------------------------------------------------?
Next you can install those variable in My.cnf as follows:?
------------------------------------------------------------------------------?? of Max_connections=100 of ? of Set-variable ? =
------------------------------------------------------------------------------?
The number of the biggest intercurrent join that it sets Mysql server is 100.Should ensure in My.cnf file [variable setting is inserted below Mysqld] caption.?

Three, watch type ?
Likelihood of user of a lot of Mysql is very open-eyed,Mysql offers 5 kinds of different watch types for the user really,Call Dbd, Heap, Isam, Merge and Myiasm.Dbd returns for clerical safety kind,And other to be not clerical safety kind.?

3.1, clerical safety ?Dbd ?The watch that watch of Berkeley ? Db(dbd) is processing of supportive general affairs,By Sleepycat software company (Http://www.sleepycat.com) is developed.It offers Mysql user to expect long already function - general affairs is controlled.Clerical control is an extremely valuable function in any database systems,Because they ensure,a group of commands are carried out successfully.?

3.2, ? of safety of blame general affairsHeap ?Heap watch is the list with the sharpest data is accessed in Mysql.Because they use memory to breath out rare index in one of dynamic memory,this is.If Mysql or server break down,another point is,Data will be missing.?
Isam ?The default that Isam watch is inchoate Mysql version expresses a kind,Till Myiasm development comes out.The proposal does not want reuse it.?
Merge ?Merge is an interesting new type,In 3.23.25 later appear.Watch of a Merge is the gather that an identical Myisam expresses actually,Amalgamative into a watch,Basically be for efficiency reason.Can raise efficiency of speed, search, repair efficiency to save disk space so.?
Myiasm ?
The default that this is Mysql expresses a kind.It is based on Iasm code,But a lot of expand usefully.The reason with better Myiasm:?Myiasm watch is less than Iasm to express,Use less resource so.?Myiasm watch is on different platform binary layer can transplant.?
Bigger key piles up dimension,Bigger key piles up upper limit.?

3.3, appoint watch type ?
The type that the watch specifies when you are founding a watch.Next exemples found a Heap to express:?
------------------------------------------------------------------------------?? of Type=heap of ? of Email_addresses of ? of Mysql%26gt;create ? Table (?
- %26gt; Null of ? of Not of Email ? Char(55) ? , ?
- %26gt; Null of ? of Not of Name ? Char(30) ? , ?
- %26gt; ? of Primary ? Key(email) ) ; ?
------------------------------------------------------------------------------?Bdb watch needs a few configuration to work,Refer to Http://www.mysql.com/doc/b/d/bdb_overview.html.?

3.4, more watch type ?
To make Mysql management job more interesting,The Mysql ? that is about to release 4 will offer two kinds of new watch types,Call Innobase and Gemeni.?

Four, optimize tool ?Mysql server itself offerred a few inside buy order is used at the help to optimize.?

4.1, Show ?
You may have fun at know Mysql server after all more what,Following command gives out a summary:?
------------------------------------------------------------------------------?? of Mysql%26gt;show ? Status;
------------------------------------------------------------------------------?
It gave out a quite long condition variable and the list that its are worth.The the time that the amount that some variable contained abort client, abort connective amount, join tries, biggest intercurrent join is counted and a large number of other and useful information.These information have value extremely to finding out systematic issue and small effect.?Show still can do more businesses.It can show the valuable information in be being expressed about log file, specific database, watch, index, process and attributive.Detailed sees Mysql manual.?

4.2, Explain ?
When you face Select sentence,How is command of Explain explanation Select handled.This indexes to deciding to whether should increase not only,And it is helpful to deciding how a complex Join is handled by Mysql.?

4.3, Optimize ?Optimize statement allows you to restore space and fragment of amalgamative data file,Lengthen to including after the watch of travel undertook be updated in great quantities and be deletinged,It is particularly important to such doing.Optimize works to be expressed at Myiasm and Bdb only at present.

...

The version after Mysql3.23.15 installs data synchronism

Mysql offers a database later from 3.23.15 version duplicate function.Use this function to be able to realize two databases synchronism,Mode of principal and subordinate,The function of mutual backup mode.

The setting of duplicate function is in database synchronism the setting of Mysql is reflected in the file.The configuration file of Mysql (it is My.cnf commonly) ,Be in below Unix environment / the My.cnf that Etc/mysql/my.cnf perhaps issues in the Home catalog of Mysql user.
In Window environment,If C: ??cangue stalking or branch sweeps past ? Y.cnf file to take this to configure a file.When the Winmysqladmin.exe tool moment of moving Mysql,This tool is met a C: ?.cnf of ? of busy of ? cangue stalking or branch names for Mycnf.bak.Found My.ini below Winnt catalog.The Mysql server moment that start can read this to configure a file.In can copying the content in My.cnf to My.ini file so,The configuration file that regards Mysql as the server with My.ini file.

Set a means:

Setting example environment:

Operating system:Window2000 Professional
Mysql:4.0.4-beta-max-nt-log
A Ip:10.10.10.22
B Ip:10.10.10.53
A: ?haddock ?BR>
1. adds the user account with a most synchronous user:
Grant File On * . * To Backup@''10.10.10.53'' Identified By ' 1234 '

2. increases a database to serve as synchronous database:
Create Database Backup
B: ?haddock ?BR>
1. adds the user account with a most synchronous user:
Grant File On * . * To Backup@''10.10.10.22'' Identified By ' 1234 '

2. increases a database to serve as synchronous database:
Create Database Backup

Mode of principal and subordinate:A-%26gt;b
A is Master

The My.ini file of modification A Mysql.Configure in Mysqld in join below configuration:
Server-id=1log-bin# setting needs to record Log to be able to install Log-bin=c:mThe catalog of file of log of Ysqlbakmysqllog setting,# among them the name that Mysqllog is log file,Mysql will build different and patulous name,The file of a few logs that file name is Mysqllog.Binlog-do-db=backup # appoints the database that needs a log

Remove a database to serve again.

With Show Master Status the command treats log condition.
B is Slave

The My.ini file of modification B Mysql.Configure in Mysqld in join below configuration:
User account Master-password=1234master-port=3306master-connect-retry=60 sets Server-id=2master-host=10.10.10.22master-user=backup # synchronism to try what 60 seconds Replicate-do-db=backup tells interval Slave does Backup database only to update again beforehand

Remove a database again

See synchronism configure a circumstance with Show Slave Status.

Notice:As a result of the configuration information that installed Slave,Mysql generates Master.info below database catalog,If have the configuration that should revise relevant Slave,should delete this file first so.The configuration that revises otherwise cannot become effective.

Mode of equipment of double machine each other.

If Slave is joined to install in A,Master is joined to install in B,The synchronism that can do B-%26gt;a.

Configure in the in configuring a file Mysqld of A join the following setting:
Master-host=10.10.10.53master-user=backupmaster-password=1234replicate-do-db=backupmaster-connect-retry=10

Configure in the in configuring a file Mysqld of B join the following setting:
Log-bin=c:mYsqllogmysqllogbinlog-do-db=backup

Notice:File of log of the *.err when should having wrong generation.Synchronous line Cheng is exited,Should let synchronous mechanism have the job after correcting an error,Moving Slave Start

Heavy machine removing Ab,Can realize two-way hot equipment.

Test:

Insert great data bulk to express Aa to B batch (1872000) ,A database per sec. can update 2500 data.

...

Class of introduction of the Mysql below Windows uses a method basically

One, Mysql brief introduction
The database server software that Mysql is Long of a cabinet spirit,To the medium, small-sized applying that the system is special ideal.Besides the statement of Ansi ? Sql that supports a level,The most important is,It still supports a variety of platform,And on Unix/linux system,Mysql supports multi-line Cheng run mode,Can acquire quite good property thereby.It and before two software are same,It is to belong to open source code soft.

Two, the installation of Mysql (point to Windows version)

the file after download solution is controlled,To a catalog,Moving Setup program,Meeting clew is whole the process of installation.Its acquiesce installs C:\Below Mysql,If want to install other catalog to fall to still have,alter something,As abecedarian,Can first without giving thought to,Install with acquiescent catalog.good,After installation,Enter C:\Below Mysql\bin catalog,Moving Mysqld-shareware.exe file

Move directly below Win98,Below normal circumstance,Without what clew information

Can input below Nt:Mysqld-shareware ?- - Install ? starts this service

Then,Input Mysql ? ,Information of a few clew can appear to give now clew mark below normal circumstance:
Mysql%26gt;

Come here,You installed Mysql already successfully.

Three, code of setting Mysql user
The acquiescent user name of Mysql database is " Root " (the ? Sa ? of Server ? of ? of Ms ? Sql is similar) ,Password silent thinks empty.In Dos clew accord with (notice,Not be Mysql clew accord with) next inputs
C:\Mysql\bin%26gt; %26quot; Mysqladmin ? - ? of U ? Root - Adminpassword of P ? Password ?

The meeting after carriage return hints you input original password,It is as a result of original password empty,Immediate carriage return,The password of Root user instead " Adminpassword " .

Four, use Mysql database simply

The database of 1. indication Mysql (notice:In this article with hind cent,If do not have clew,The command of the input is to be below Mysql clew accord with)
Show ? Databases

2. opens a database
Use ? Test

Among them,Test is database name

3. shows all data in a database express ? (must open a database first) ? ? ?
Show ? Tables
Go

4. founds a database with Root identity (in Dos clew symbol falls)
Mysqladmin ? - ? of U ? Root - ? Gsbook of Create of ? of Adminpassword of P ? Password ?

Can hint you input a password then.Because of,Our purpose is to do to leave a message board,I name the name of the database here for " Gsbook " .

5. joins data list in the database
Auto_increment of ? of Null of ? of Not of ? of Int of ? of Gsbook(id of ? of Create ? Table, primary ? Key(id) , nickname ? Varchar(30) , email ? Varchar(30) , homepage ? Varchar(30) , note ? Text, w_time ? Datetime)

...

How need not process designing derives data SQL MYSQL

Derive from Sql the method of Mysql is very much,Introduce a kind now need not process designing,The simple method that uses the graphical interface in Sql and Mysql to undertake guiding deriving directly.

Premise is the Phpmyadmin of tool of graphical interface government that had installed Sqlserver client end and Mysql.

Sqlserver business management is opened below console root catalog implement,Build Sqlserver group,Undertake choosing according to oneself circumstance;Build Sqlserver to register next,The link that has pair of Sqlserver.After preparation is proper,Began below:

Open data to change a service above all,Build a packet,Open DTS interface,In join choice data source undertakes configuration.The purpose file that reelection choose will change,The Textfile(destination) that I choose here,Choose good file after depositing the position,We will build a task.We choose to change data job only here,Will contain " choice source joins " " choice purpose joins " the mouse parts after source of pitch on data and purpose,The link that we become to the new student has a definition,In source of its attribute lieutenant general,Purpose,Change ordinal definition.

Executive task,Clew is successful.Save the job.Derive on newly-built task next data,Guide hints,Among them a choice " from source data library duplicate watch is mixed view " .

This one pace has derived data in purpose file.

Build a list in Mysql next,When keeping consistent with the structure that will guide,Choose directly " from data of the extraction in text file,Insert data to express:" ,After buying option," send " OK,Browse,Data already guided.If want the list that guides,had existed,And attribute name is different also,The list that builds an as identical as the data that should guide structure first at this moment guides data (by a moment ago it is OK to undertake) ,Derive in Mysql next " data and structure " ,Receive Sql sentence,In the editor in text file its,Use text editor replace a function,the watch the name is revised,Row name is joined,Finally its stickup wanting to guide the place of the executive Sql statement of the watch,Carry out,Data guided.

The mistake appears in be like a process,The option that asks microscope configuration,Ensure correct.

...
« 首页...« 1 2 3 4 5 6 7 8 9 10 11 12 13 14 »...尾页 »