Feed on
Subscription

Solution of data backup system

? ? as computer network gain ground,The opportunity that computer virus had fast transmission,And be opposite count those who seize a file to destroy increasingly serious,User need often is opposite important data does the individual different ground backs up.The consideration that is based on much user and data privacy,Offerred solution of system of individual data backup.Characteristic of the high capacity that it uses a network to store equipment is had, high reliability, high security,The space that provides certain capacity for the user will save individual data,The confidential sex that the attributive government that uses software at the same time realizes individual data well.

At present software of server of the FTP below Linux basically has ? ? Wu-FTP and ProFTPD two kinds.Wu-FTP is Red Hat Linux installs software beforehand,But safe flaw is very much.ProFTPD is aimed at the weak sports of Wu-FTP and develop,Divide outside improving security,Still have a lot of characteristics,If install simple, can move with Stand-alone mode etc.After ProFTPD has become afterwards Wu-FTP one of most popular FTP server software.

? ? ProFTPD uses date of Linux user Zhang to run an user before 1.2 version,Although use countersign document.This means is put in a lot of inadequacy,Than with database operation photograph,Of the modification of the addition of user Zhang date, countersign and Zhang date delete appear very complex,And the file cannot support erupt simultaneously read write;In the limits of authority that date of Zhang of the user in Linux has Telnet,Hidden trouble of the existence on safety;Only Root Zhang date can alter countersign document,If use browser means to alter this document,There is certain difficulty on the technology.

The function that ? ? increased database management user in ProFTPD 1.2.4 edition,Support MySQL database only at present,And date of be in debt applies to FTP server only,The hidden trouble on nonexistent safety.The development platform that the article uses is combination of Linux + ProFTPD + MySQL.

? ?Overall design

Tiring-room of ? ? system uses FTP server to provide administrative document function for the user,All sorts of software that can use function of supportive FTP will handle data document.Date of Zhang of solution implementation user applies for automatically to accept, the password is revised,Network administrator can use a browser to manage Zhang date to revise dimensional set limit to, modification countersign to reach delete the function such as Zhang date.

The core of ? ? system is how to use development language to configure ProFTPD dynamicly,The Zhang number that implements numerous to the amount user manages.

? ?The solution is detailed content

The installation of ? ? concerned ProFTPD and the data that configure file content are OK detailed sees systematic documentation,The part that article key introduction and database concern.

? ? 1. Install ProFTPD

? ? (1) installation MySQL database,The installs catalog sign that founds MySQL,Join arrives / Usr/local/mysql.

? ? (2) the configuration before compiling,In adding MySQL and module of dimensional set limit to the option that compile,Code is as follows:

? ? # . / Configure- - With-includes = /usr/local/mysql/include- - With-libraries=/usr/local/mysql/lib/mysql- - With- Modules=mod_sql:mOd_sql_mysql:mOd_quota

? ? 2. Increase an user

? ? founds FTPusers database and Users watch to be used in MySQL save information of FTP Zhang number,Code is as follows:


...

The SQUID representative server of user attestation function

The binary system that the installation of SQUID and MYSQL used SUN to release installs a bag,It can be found in Software_companion_x86 CD;MYSQL_AUTH can be found with GOOGLE search.

One, installation configures SQUID+MYSQL

1. establishs user and group
# Groupadd Squid
# Useradd -g Squid -d /dev/null -s /bin/false Squid
# Groupadd Mysql
# Useradd -g Mysql -s /bin/false Mysql

2.Install MYSQL


...

Solution can carry problem of Mysql.sock join MySQL anything but

? ? this problem basically hints is,Cannot connect a server through '/tmp/mysql.sock' ,And Php standard configuration has used '/tmp/mysql.sock' just about,But method of installation of a few Mysql puts Mysql.sock in / the where with other perhaps Var/lib/mysql.sock,You can be passed revise / Etc/my.cnf file will amend it,Open a file,Can see as follows east east:
? ? [Mysqld]
? ? Socket=/var/lib/mysql.sock
It is good that ? ? changes,But also can pose other issues,Did not go up repeatedly like Mysql program,Add a a little bit again:
? ? [Mysql]
? ? Socket=/tmp/mysql.sock
? ? still perhaps can pass the configuration in modification Php.ini to make Php is connected with other Mysql.sock,This him everybody goes searching
? ?
? ? perhaps uses such method:
? ? Ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
? ?
? ? still has:
The manual of ? ? Phpmyadmin has say
? ? The Error Message "Warning: MySQL Connection Failed: Can't Connect To Local MySQL Server Through Socket '/tmp/mysql.sock' (111) . . . .. Is Displayed. What Can I Do?
? ?
? ? For RedHat Users, harald Legner Suggests This On The Mailing List:
? ?
? ? On My RedHat-Box The Socket Of Mysql Is /var/lib/mysql/mysql.sock. In Your Php.ini You Will Find A Line
? ? Mysql.default_socket = /tmp/mysql.sock
? ? Change It To
? ? Mysql.default_socket = /var/lib/mysql/mysql.sock
? ? Then Restart Apache And It Will Work.
? ?
? ? Here Is A Fix Suggested By Brad Ummer In The Phpwizard Forum:
? ?
? ? First, you Need To Determine What Socket Is Being Used By MySQL.
? ? To Do This, telnet To Your Server And Go To The MySQL Bin Directory. In This Directory There Should Be A File Named Mysqladmin. Type. / Mysqladmin Variables, and This Should Give You A Bunch Of Info About Your MySQL Server, including The Socket (/tmp/mysql.sock, for Example) .
? ? Then, you Need To Tell PHP To Use This Socket.
? ? Assuming You Are Using PHP 3.0.10 Or Better, you Can Specify The Socket To Use When You Open The Connection. To Do This In PhpMyAdmin, you Need To Complete The Socket Information In The Config.inc.php3.
? ? For Example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

...

MySQL security guideline (2)

2.1.3 database and watch attributive
The operation that following authority restricted transport uses on database and watch.

ALTER
Allow sentence of your use ALTER TABLE,This is an attributive of simple the first class actually,You must by other attributive,This sees you want what to carry out to operate to the database.
CREATE
Allow you to found database and watch,But do not allow to found index.
DELETE
Allow you to delete existing record from inside the watch.
DROP
Allow you to delete (abandon) database and watch,But do not allow to delete reference.
INDEX
Allow you to found and delete reference.
REFERENCES
At present need not.
SELECT
Allow statement of your use SELECT to retrieve data from inside the watch.Needless to involving the SELECT statement of the watch,Be like SELECT NOW() or SELECT 4/2.
UPDATE
In allowing your modification watch already some records.
2.1.4 manages attributive
Following authority restricted transport is used at controlling a server or the administrative sex of the operation of user accredit ability is operated.

FILE
The document that allows you to tell to the server is read or write server lead plane to go up.This attributive should not award casually,It is very dangerous,See " evasive accredit expresses a risk " .Server really more careful ground maintains this limits of authority is used inside certain limits.The document that you can read anybody only.The file that you are keeping must not be existent file,This prevents you to force service regard highly to keep important file,Be like / Etc/passwd or the data catalog that belong to the database of others.
If attributive of your accredit FILE,Ensure you do not run a server with the Root user of UNIX,Because Root can be in of file system found new document anyplace.If you are not prerogative user with,run a server,The server can be in only the user can found a file in the catalog of the visit.

GRANT
Allow you to grant others yourself's limits of authority,Include GRANT.
PROCESS
Allow you to examine the line Cheng that moving inside the server through using SHOW PROCESS statement or Mysqladmin Process order (process) information.This attributive also allows you to kill line Cheng with KILL statement or Mysqladmin Kill command.
The line Cheng that you always can see or kills yourself.PROCESS attributive gifts the ability that you do these businesses to any line Cheng.

RELOAD
Allow you to carry out many server management to operate.You can issue FLUSH statement,The command such as the Reload that you also can point to sexual Mysqladmin, Refresh, Flush-hosts, Flush-logs, Flush-privileges and Flush-tables.
SHUTDOWN
Allow you to shut a server with Mysqladmin Shutdown.
In User, Db and Host watch,Each attributive is appointed with an alone row.These list full statement to be an ENUM("N" , "Y") type,So the default value of every authority is " N " .The attributive in Tables_priv and Columns_priv expresses with a SET,It allows attributive to be appointed with any combination with a single line.These two watch comparing are other three watches are updated,This is why they use the more effective account that shows pattern.(likely in future,User, Db and Host watch also use type of a SET to express.)

The Table_priv row in Tables_priv watch is become by the definition:

SET('Select' , 'Insert' , 'Update' , 'Delete' , 'Create' , 'Drop' , 'Grant' , 'References' , 'Index' , 'Alter' )
The Column_priv row in Coloums_priv watch is become by the definition:?

SET('Select' , 'Insert' , 'Update' , 'References' )
Row limits of authority is less than expressing attributive,Because list step less limits of authority is significant.For example you can found a watch,But you cannot establish an isolated line.
User watch is included certain the kind that expresses nonexistent attributive in other accredit:File_priv, Process_priv, Reload_priv and Shutdown_priv.These authority restricted transport use at you to let a server carry out with any specific databases or watch irrelvant is operated.What is if allow an user basis,current database will shut a database is fine long hair is insignificant.

How does 2.2 server dominate client visit
When your use MySQL,Client visit control has two level.The first phase happens in you to try to join when the server.The name that the server searchs User watch to see it whether can find an entry to match you, you are in wherefrom the word of command that connective lead plane and you offer.If did not match,You cannot join.If one matchs,Establish link and continue the second phase.In this phase,To the inquiry that each you give out,Watch of server examination accredit sees you whether enough limits of authority carries out inquiry,The second phase lasts to you and the end that the server speaks

...

MySQL security guideline (3)

2.4 need not GRANT installs an user
If you have to antedate the MySQL version of 3.22.11,You cannot use GRANT (or REVOKE) statement setting user and its visit attributive,But the content that you can modify accredit to express directly.If you understand GRANT statement how to revise accredit,express,This is very easy.So you yourself can do same business through issueing INSERT statement by hand.

When you issue statement of a GRANT,You designate an user name and leader name,The likelihood still has countersign.Generate an User souvenir to record to this user,And these value records are in User, Host and Password row.If you are in GRANT statement,appoint global attributive,These attributive records are in the attributive row of the record.Want among them careful is GRANT statement adds close countersign for you,And INSERT is not,You need to use PASSWORD() function to add close countersign in INSERT.

If you appoint database class attributive,The User that user name and leader name are expressed in Db by the record and Host are listed.You are recorded for the database of its accredit in Db row,The attributive record that you award is in attributive row.

To expressing class and row class attributive,The effect is similar.The record is established in Tables_priv and Columns_priv watch in order to record user name, leader name and database,Still have relevant watch and kind.The attributive record that award is in attributive row.

If you still remember the introduction in front,You should can although need not the business that GRANT statement also can do GRANT.When remembering revising accredit to express directly in you,You express accredit of announcement server burden,Otherwise the change that he does not know you.You can carry out a Mysqladmin Flush-privileges or Mysqladmin Reload command forces a burden.If you forget,do this,You will be interrogative why the business that the server does not do you to want to do.

The super user that following GRANT statement founds to own property.The faculty that includes accredit to give others:

GRANT ALL ON * . * TO Anyname@localhost IDENTIFIED BY "passwd "
WITH GRANT OPTION
This statement will be Anyname@localhost to establish a record in User watch,Open all attributive,Because here is super user (overall situation) the place that attributive stores,Should do same business with INSERT statement,The statement is:

INSERT INTO User VALUES(%26quot;localhost%26quot; , "Anyname" , PASSWORD("passwd") ,
"Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" )
You may discover it does not work,The MySQL version that this wants to see you.The structure that accredit expresses has been changed and your User watch in you may do not have 14 attributive to list.Every limits of authority that the accredit watch that finds out you with SHOW COLUMNS contains is listed,The INSERT statement that adjusts you accordingly.The user that following GRANT statement also founds to have super user capacity,But have a single limits of authority only:

GRANT RELOAD ON * . * TO Flush@localhost IDENTIFIED BY "flushpass "
The INSERT statement of this exemple is simpler than before one,It lists name of break the ranks very easily and appoint an attributive to list only.All other row is the setting default "N" :

INSERT INTO User (Host, password, reload) VALUES("localhost" , "Flush" , PASSWORD("flushpass") , "Y" )
Database class attributive uses an ON Db_name. * is clausal and not be ON * . * has authorization:

GRANT ALL ON Sample. * TO Boris@localhost IDENTIFIED BY "ruby "
These attributive are not overall situation,So they do not store in User watch,We still need to establish a record in User watch (make the user can join) ,But we also need to found collection of souvenir of a Db to record database market attributive:
INSERT INTO User (Host, user, password) VALUES("localhost" , "Boris" , PASSWORD("ruby") )

INSERT INTO Db VALUES("localhost" , "Sample_db" , "Boris" , "Y" , "Y" , "Y" , "Y" , "Y" , "Y" , "N" , "Y" , "Y" , "Y" )

"N" row is to be GRANT attributive;The GRANT sentence that has WITH GRANT OPTION to a last database step,You should install this to label "Y" .

...

The Mysqldump in MySQL commands use detailed is solved

? ? MySQL has a lot of to be able to guide into the method of data,However these just are counted according to transmitting medium half,Another it is commonly derive from inside MySQL database data.Have a lot of reasons we need to derive data.A main reason is to be used at backup database.The cost of data often costly,Need handles them carefully.Often backup can be helped prevent valuable data ground to lose;Another reason is,Perhaps you hope to derive data will share.In the world that this IT grows ceaselessly,Share data to become commonner and commonner.

The large database that says Macmillan USA safeguards the works that protecting to will be published for example.This database is shared between a lot of bookshops,Such they know what book will be published very quickly.Hospital more and more the trend uses the anamnesis that do not have paper to record,Such these anamnesis can follow you at any time.The world becomes smaller and smaller,Information also is shared increasingly.In having a lot of, derive data gets a means,They follow guide data is very similar.Because of,After all,These are a kind of fluoroscopy gets way only.The data that the data that derives from the database guides from another end namely.We do not discuss other databases to derive variously here the method of data,How do you come to the society realize data to derive with MySQL.
? ?
? ? uses Mysqldump:
? ?
? ? (Mysqldump command is located in in Mysql/bin/ catalog)

Tool of ? ? Mysqldump a lot of sides are similar and opposite the tool Mysqlimport of action.They have a few same option.But Mysqldump can do more businesses.It can lade whole database in an alone text file.This file bag contains all rebuilding the SQL that your database place needs commands.This command obtains all mode (Schema,There is an explanation from the back) and change its into DDL grammar (CREATE statement,Namely the database defines a statement) ,Obtain all data,And found INSERT statement from inside these data.All this tool in the database designs you are inverse.Because all things are included,arrived in file of a text.This text file can use a simple batch processing and statement of an appropriate SQL to guide in returning MySQL.This tool makes a person fab ground is simple and fast.Will never have the least bit let poll be fond of ground place.
? ?
? ? because of this,If you resemble lading,the content of whole database Meet_A_Geek arrives in a file,Can use the order below:

P Meet_A_Geek of - of ? ? Bin/mysqldump%26gt;MeetAGeek_Dump_File.txt
? ?
Does this statement also allow ? ? do you appoint a watch to undertake Dump(backs up / derive / lade? ) .If you are the in expressing Orders whole content that hopes a database Meet_A_Geek is medium only,derive to a file,Can use the order below:

P Meet_A_Geek Orders %26gt;MeetAGeek_Orders.txt of - of ? ? Bin/mysqldump
? ?
? ? this exceedingly agile,The record that you can use WHERE subordinate clause to choose you to need even derives in the file.Should achieve such goal,Can use be similar to the command below:

Where="Order_ID of - of P of - of ? ? Bin/mysqldump%26gt;2000" Meet_A_Geek Orders%26gt;Special_Dump.txt
? ?
Tool of ? ? Mysqldump has many option,Partial options is expressed as follows:

? ? option / Option action / Action Performed

? ?- - Add-drop-table

? ? imposes sentence of DROP TABLE IF EXISTS before this option will express in each,Can assure to guide when answering MySQL database, won't make mistake so,When because guide every time,be being answered,Can check a watch to whether exist above all,Exist to be deleted

? ?- - Add-locks

This option meets ? ? bind a LOCK TABLE and UNLOCK TABLE statement in INSERT statement.This prevents to record the operation that is guided other user undertakes to the watch when the database again in these
? ?
? ? - C Or - Complete_insert

? ? this option makes Mysqldump command produces INSERT statement to add the above-listed to each (Field) name.Should derive data guide this option when another database is very useful.

? ?- - Delayed-insert adds DELAY option in INSERT command

? ? - F Or -flush-logs uses this option,Carrying out before deriving will the Log of refresh MySQL server.

? ? - F Or -force uses this option,Although have mistake happening,Still continue to derive

? ?- - Full in the sentence that this option also imposes additional information to CREATE TABLE

? ? - L Or -lock-tables uses this option,Derive when expressing, the server will add a lock to the watch.

? ? - T Or -no-create- Info

The Mysqldump that this option makes commands ? ? not to found CREATE TABLE statement,This option needs data only in you and do not need DDL (the database defines a statement) when very convenient.
? ?
? ? - the Mysqldump that this option makes commands D Or -no-data not to found INSERT statement.

? ? when you need DDL statement only,Can use this option.

? ?- - the option of the file that Opt this option will open all meetings to raise a file to derive speed and creation can guide more quickly.

? ? - Q Or -quick this option makes MySQL won't whole derived content reads in memory to be carried out again derive,Write when be read however guide in the file.

? ? - this option will found T Path Or -tab = Path two files,A file includes DDL statement to perhaps be expressed found a statement,Another file includes data.DDL file name Table_name.sql, data file name Table_name.txt. Method name is the catalog that deposits these two files.Catalog must have existed,And jussive is used person the privilege that has pair of files.
? ?
? ? - W "WHERE Clause" Or -where = "Where Clause "

? ? if in front what tell,You can use this one option to choose will put derive the data of the file.
? ?
? ? assumes you need to express the account that should use in sheet to build a file for,The manager should look this year (2004) all order (Orders) ,They are not interested in DDL,And need a document have comma space,Because guide very easily so,arrive in Excel.To accomplish this individual thing,You can use the sentence below:

Where %26quot;Order_Date %26gt;='2000-01-01' of - of P of - of ? ? Bin/mysqldump %26quot;
Fields-terminated-by= of - of No-create-info of - of Tab = /home/mark of ? ? -, meet_A_Geek Orders

This will get ? ? the result that you want.
? ?
? ? Schema:Mode

? ? The Set Of Statements, expressed In Data Definition Language, that Completely Describe The Structure Of A Data Base.

? ? defines the statement market that the language will come convey one group with data, the structure that this statement collect described a database thoroughly.
? ?
? ? SELECT INTO OUTFILE:

? ? if you feel Mysqldump tool is insufficient cruel,Use SELECT INTO OUTFILE, the order that MySQL offers to have adverse effect with command of LOAD DATA INFILE likewise,This is command of SELECT INTO OUTFILE,These two place that command the likeness that has a lot of.Above all,They have all option almost identical.You need to finish now in front with the function that Mysqldump fulfils,Can the measure below according to undertakes operating:
? ?
? ? 1. Ensure Mysqld process (service) having movinging

? ? 2. Cd /usr/local/mysql

? ? 3. Bin/mysqladmin Ping;/ / if this sentence has not been connected,Can use this:Mysqladmin -u Root -p Ping

? ? Mysqladmin Ping is used at detecting the condition of Mysqld,Is Alive specification is moving,Make mistake need user name and password possibly.

? ? 4. The MySQL that start monitors a program.

? ? 5. P Meet_A_Geek of Bin/mysql -;/ / enter Mysql command to go,And open database Meet_A_Geek, need inputs a password

? ? 6. In command travel,Input a command:

? ? SELECT * INTO OUTFILE '/home/mark/Orders.txt'
? ? FIELDS
? ? TERMINATED BY = ' , '
? ? FROM Orders
? ? WHERE Order_Date %26gt;= '2000-01-01'
? ?
? ? pressed Return in you (carriage return) later,The file was founded.The SELECT statement with this regular like sentence,Just weigh the output that considers screen directional arrived in the file.This imply this advanced inquiry that you can use JOIN to realize much watch.This characteristic also can be used as generator of a forms for reporting statistics.
? ?
? ? example says,You can combine the method that discusses in this one chapter to produce an absorbing inquiry,Try this:
? ?
? ? builds a text file that the name is Report_G.rpt in Mysql catalog,Join the travel below:

? ? USE Meet_A_Geek;
? ? INSERT INTO Customers (Customer_ID, last_Name, first_Name)
? ? VALUES (NULL, "Kinnard" , "Vicky");
? ? INSERT INTO Customers (Customer_ID, last_Name, first_Name)
? ? VALUES (NULL, "Kinnard" , "Steven");
? ? INSERT INTO Customers (Customer_ID, last_Name, first_Name)
? ? VALUES (NULL, "Brown" , "Sam");
? ? SELECT Last_Name INTO OUTFILE '/home/mark/Report.rpt'
? ? FROM Customers WHERE Customer_ID%26gt;1;

? ? affirms Mysql process is moving next,And you are in Mysql catalog,The command below the input:

? ? Bin/mysql%26lt;Report_G.rpt checks you to name the file that serves as output,The last name that this file will include all clients that you input in Customers watch.Be seen like you,You can use what acquire today to guide / derive (Import/export) the method will help get forms for reporting statistics.

...

Of MySQL server start with stop

? ? , run MySQL server in order to be not prerogative user

Before ? ? is discussing how to start MySQL server,Let us consider to should run MySQL server with what user identity.The server is OK the hand is moved or start automatically.If your hand is moved,start it,The server logs onto Unix with you (Linux) user identity is started,If you are used,start a server namely,It moves with Paul;If you use Su to command switch to Root,Carry next the server that start,Criterion it moves with Root.However,You may not think the hand moves the server that start below most circumstance,It is you arrange MySQL server to be started automatically when systematic guiding likely most,As the one part of standard guiding process,Below Unix,Should guide a process to be carried out by Unix user Root of the system,The course that why and allow runs in this process all moves with Root attributive.

...

Grammar of MySQL database SQL is referenced

? ? one, l of d of data definition d (Data Definition Language)

? ? data decides a language is the language that the format that points to pair of data and configuration give a definition,He is every data-base should build what should face above all when moment,Data ranginging from... to... distributes what form inside relation, form have what column advocate the relation that consults each other between key, form and form is waited a moment,It is to be in what when beginning, place must have planned.

...

The inquiry that MySQL inquiry optimizes series lecture is optimized implement

? ? when you refer an inquiry,MySQL can analyse it,Look to whether can be done a few optimize the speed that makes handle this inquiry faster.This one part optimizes introductory inquiry implement be how work.If you think those who use to know MySQL,optimize a method,Can examine MySQL reference manual.

? ? of course,MySQL inquiry is optimized implement also used index,But it also used other a few information.For example,If you refer following shows inquiry,No matter data is expressed,have so how old,The rate that MySQL implements it is met very fast:


...

MySQL inquires the data type that optimizes series lecture and efficiency

This one part offerred ? ? how to choose data type to help a few guidance that increase inquiry traversal speed:


? ? does not want those who grow to use when can use short data to list.If you have fixed length of a solid,spent CHAR data is listed,The length that should not let it so exceeds real need.If you are in what store in data row,the longest value has 40 character,Do not define CHAR(255) ,And should define CHAR(40) .If you can use MEDIUMINT to replace BIGINT,So your data table is a few smaller (disk I/O is a few less) ,In computational process,The processing rate of the value is a few rapidder also.If data row was indexed,So the property that uses shorter value to bring rises more remarkable.Index not only can raise inquiry rate,And short index value also is worth processing to rise than chief index should a few faster.

? ? if the memory form that you can choose data to go,Should use what suit memory engine most so the sort of.To MyISAM data table,The data that the data line that had better use fixed length replaces alterable length is listed.For example,Let all character rows replace VARCHAR kind with CHAR type.Count the cost,We can discover data table used more disk spaces,But if you can provide extra space,The data that the rate that the data of so fixed length is treated all right spends than growing changeably wants all right a few faster.To those watches that are revised often,This are highlighted especially,Below those circumstances because of,Performance gets more easily the influence of disk fragment.

When ? ? is using the data of alterable length to go,Differ as a result of record length,Carrying out for many times after delete and be being operated newlier,The fragment that data expresses wants a few more.You must use OPTIMIZE TABLE to defend its performance regularly.The data of fixed length does not have this problem all right.

If ? ? appears the circumstance that data table breaks down,So the watch that data travel length secures constructs more easily afresh.When using fixed length data to go,The beginning of every record the position can be detected,Because these positions are the multiple of fixed record length,But when using alterable length data to go not certain.This is not the problem related to the function that inquires processing,But the repair rate that it can accelerate data to express certainly.

Although ? ? changes MyISAM data table into the data line that uses fixed length to be able to improve performance,But you need a consideration above all below a few problems:

The data line rate of fixed length of ? ? is rapidder,But the space that take up is larger also.Every value that CHAR(n) lists (even if empty value) occupy N normally character,Because store it until data table is medium,this is,Blank space can be added at the back of of the value.The space that VARCHAR(n) row has is lesser,Because need to allocate necessary character only number is used at memory to be worth,Add two on one byte to store the length of the value.Because of this,When undertaking choosing between CHAR and VARCHAR row,The contrast that is time and space actually.If speed is main consideration factor,So the performance advantage that gets fixed length kind with respect to row of use CHAR data.If the space is very serious,So list with respect to use VARCHAR data.Altogether,The data that you can think to secure length can improve performance all right,Although it took up larger space.But to certain and special application program,You may hope to use two kinds of means to realize a certain data to express,The requirement that runs a test to decide which kinds of circumstance accords with applied process next.

Although ? ? is willing to use fixed length type,Occasionally you also are used without method.For example,Grow to cannot use fixed length type at the string of 255 character.

The data that table of data of ? ? MEMORY uses fixed length at present stores all right,No matter use CHAR or VARCHAR line,did not concern accordingly.Both is to serve as what CHAR type handles.

? ? is expressed to InnoDB data,In-house travel memory format does not have divisional and fixed length and alterable length row (all data use the head index that points to data to list a value all right) ,Because this is in substantially,The CHAR kind that uses fixed length is not certain row of VARCHAR of more alterable than using length is simple.Consequently,Main property factor is the memory gross that data exercise uses.The space that takes up on average as a result of CHAR over VARCHAR,Because this uses VARCHAR to come the smallest the memory gross that changes the data travel that needs processing and disk I/O are better.

? ? is expressed to BDB data,No matter use firm,the data of alterable length is listed,The difference is not big.You can use two kinds of methods try,Run test of a few tests to detect whether to put in apparent difference.

? ? defines data kind into cannot be empty (NOT NULL) .This meeting makes processing rate rapidder,The memory of need is fewer.It still simplified to inquire occasionally,The NULL property that because be below certain circumstance,you do not need to examine a cost.

Data of use ENUM of ? ? consideration is listed.The cardinal number that if you have some a certain data,lists is very small (included different worth amount is limited) ,Can consider to list its changeover for ENUM so.ENUM value can be handled by faster ground,Because of them interiorly expression is numerical value.

? ? uses PROCEDURE ANALYSE() .The case that moving PROCEDURE ANALYSE() can see be listed in data table:


...
« 首页...« 5 6 7 8 9 10 11 12 13 14 15 16 17 18 »...尾页 »