Feed on
Subscription

MySQL data guides derive method and tool

The interpreter states:The partial content that article content comes from one book of Sam's Teach Yourself MySQL In 21 Days,English of By Mark Maslakowski is textual the person that copyright belongs to original work is all,The partial interpreter of Chinese has somewhat the too clear place that original book of; of additions and deletions tells has cutout,The not clear place that tell has add;If have the place with the interpreter's incorrect perhaps misgivings,Ask point out mistakes so that they can be corrected.
Translator:David Euler, SCU. De_euler-david@www.yahoo.com.cn

1) the grammar introduction of.mysqlimport:
Mysqlimport is located in in Mysql/bin catalog,One be Mysql loads (perhaps say to guide) a of data very effective tool.This is tool of travel of a command.Two parameter and many options can offer an alternative.This tool file of a text (Text File) in the database that guides you are appointed and watch.In saying we want to guide data into the watch Custermers in database Meet_A_Geek from inside file Customers.txt for example:Mysqlimport Meet_A_Geek Customers.txt

Notice:Customers.txt is we should guide here the text file of data,And Meet_A_Geek is the database that we should operate,The watch name in the database is Customers,The data format of here text file must agree with the format in Customers watch,Otherwise Mysqlimport command will make mistake.

The name that expresses among them is to guide the first full stop of the file (. ) in front file string,Another example:Mysqlimport Meet_A_Geek Cus.to.mers.txt
So we will guide the content in the file into the Cus watch in database Meet_A_Geek.

In the example above,Use two parameter only,Did not use more option,The option of Mysqlimport introduces below

2) the commonly used option of.mysqlimport introduces:

Option function
- D Or- - Delete new data guides data data is deleted to express all medium information before data table is medium
- F Or- - no matter whether Force encounters a mistake,Mysqlimport will continue compulsively to insert data
- I Or- - Ignore Mysqlimport is jumped over or those have oversight identical and exclusive

The travel of key word,Guide the data into the file will by oversight.
- before data of L Or -lock-tables is inserted, chain watch,Prevented so,When you are updating a database,The inquiry of the user and be affected newlier.
- R Or -replace this option and - the effect of I option is adverse;This option records what there is identical and only key word in replacing a list.
- - when Fields-enclosed- By= Char appoints the record of the data in text file, rise with what draw together,The data below a lot of circumstances rises with double quote draw together.The data below acquiescent circumstance is to do not have what be removed by character draw together.
- - the separator between the value that Fields-terminated- By=char assigns each data,In the file of full stop space,Separator is full stop.You can appoint the separator between data with this option.Acquiescent separator is to jump case accord with (Tab)
- - this option of Lines-terminated- By=str appoints the travel in text file and travel between the disjunctive string of data or character.The Mysqlimport below acquiescent circumstance is a separator with Newline.You can choose to replace a single character with a string:Go newly or a carriage return.The option with Mysqlimport commonly used command still has - V shows version (Version) ,- P clew inputs a password (Password) etc.

3) . Example:Guide one is the file of separator with comma

The format of the travel in the file is such:
"1" , "ORD89876" , "1 Dozen Roses" , "19991226 "
Our task is to want to guide the data inside this file into the form Orders in database Meet_A_Geek,We use this order: Fields-terminated-by= of - of Fields-enclosed-by=" of - of Prl of Bin/mysqlimport -, meet_A_Geek Orders.txt
This command may look very accurate,After was familiar with when you nevertheless,This is very simple.The first part,Bin/mysqlimport, telling an operating system you want the order that move is the Mysqlimport below Mysql/bin catalog,Option P is requirement input password,Ask you are altering so the password is inputted before the database,The operation rises the meeting is safer.Because we want a list,we used R option is the data in there is the record that repeats only key word to replace a document in medium only key word and file record.We express the data in sheet is not newest,The data in needing to use a document goes updating,Use R consequently this option,In replacing a database already some records.The action of L option is chain when we insert data watch,The operation that when preventing an user to replace a list in us so, has inquire or be changinged to the watch.

...

SQLserver database guides the experience of Mysql database

Because of working need,Want to will deposit the data in Sql Server database to guide entirely in Mysql database,Be in on the net related collect data,Find two kinds of methods,Talk about the view to them respectively now.
The first kind is installation Mysql ODBC,Those who use Sql Server derive function,Source of choice Mysql data,Derive directly into what linage occupies,This kind of method is very simple,But have a lot of corrupt practice in the light of actual application,The mainest reflecting is data type problem,Above all,In Sql Server database
Ntext, the data of the data type such as Image cannot be written directly in Mysql database,It is OK to should alter slightly only allegedly,Regrettablly occasionally this dish bird has not thought of how to alter,Next,Because design lieutenant general time to be set into Int in the database in Mysql occasionally model (those who save is time jab) ,Guide in data so after coming over,With respect to meeting occurrence conflict,Again,The field kind that the Mysql data that this kind of method generates expresses is very not right,So this is planted method I feel that this cannot be advocated.

The second kind is to use Php or Asp script to come to those who realize data to guide into the function,This kind of method needs to write a program,But flexibility is big,The operation also is not so difficult,Everything all is in your control,Introduce this method simply now
The Mysql environment that premise condition is you has been built,Build good cause database first,Build all watch structures with Sql statement again,All things is had now,Lack data only.

The data in the User watch that can realize database of the Mydb in Sql Server originally through the Php foot below guides to database of the Mydb in Mysql
%26lt; ?
$cnx = Odbc_connect('web' , 'admin' , the data source name that '123456');//'web' is the Mydb in Sqlserver,The user name that 'admin' is visit Mydb,'123456' is the password that visits Mydb
$cur= Odbc_exec($cnx, 'select * From User' );// opens the User table of database of the Mydb in Sql Server
$num_row=0;
$conn=mysql_pconnect("localhost" , "Root" , "Mysql of 123456");// join
@mysql_select_db('mydb' , $conn) Or
Die(" cannot receive a database repeatedly,Contact with the administrator please!") the Mydb database that;// opens MysqlWhile(Odbc_fetch_row($cur)) // takes out data one by one from the User watch in the Mydb library of Sql Server,If undertake choosing to data,The condition can be added to judge in the Select statement in front
{
$num_row++;
$field1 = Odbc_result($cur, the parameter I(1 here, 2, 3. . ) the I that those who point to is record concentration region,You can choose the ground to undertake choosing somewhat,The value that Fieldi gets corresponding region,Next you can undertake operating to Fieldi
$field2 = Odbc_result($cur, 2);
$field3 = Odbc_result($cur, 3);
$field4 = Odbc_result($cur, 4);
$field5 = Odbc_result($cur, 5);
$field6 = Odbc_result($cur, 6);
The field that pair of Datetime types in Sql Server are here undertakes be changinged accordingly handling,The Int that changeover needs into me
$querystring = "insert Into User
(Id, name, username, password, recdate)Values('$field1' , '$field2' , '$field3' , '$field4' , '$field5')" ;
Mysql_query($querystring, $conn);
}
Function Timetoint($str){
$arr1=split(" " , $str);
$datestr=$arr1[0];
$timestr=$arr1[1];
$arr_date=split("-" , $datestr);
$arr_time=split(" :" , $timestr);
$year=$arr_date[0];
$month=$arr_date[1];
$day=$arr_date[2];
$hour=$arr_time[0];
$minute=$arr_time[1];
$second=$arr_time[2];
$time_int=mktime($hour, $minute, $second, $month, $day, $year);Return $time_int;
}
? %26gt;

Put this paragraphs of script into Sql.php,Carry out on the server,Can get on the server the data in the User watch of database of the Mydb in Sql Server guides the User of database of the Mydb in Mysql goes in the watch.The operation of other watch and this is duplicate,not give uncecessary details.

The data of database of the Mydb in Asp script introducing to realize Sql Server again below guides to database of the Mydb in Mysql
%26lt;%Set Conn=server.createobject("adodb.connection" )Conn.open 'web' , 'admin' , the data source name that '123456' // 'web' is the Mydb in Sqlserver,The user name that 'admin' is visit Mydb,'123456' is the password that visits MydbSet Rs=server.createobject("adodb.recordset" )Sql="select ID, name, username, password, datediff(s, '1970-01-01 00:00:00' , recdate)-8*3600, reid, filename, fileContentType, the Int that this Sql statement realized Filevalue From Senddate" // to change the Recdate field of Datetime type into Unix time jab
Rs.open Sql, conn, 1, 3Set Conn1=server.createobject("adodb.connection" )Conn1.open "myoa" , "Root" , "Q1-d6=7? "Q1-d6=7?? I=1Do While Not Rs.eofField1 = Rs(0)Field2 = Rs(1)Field3 = Rs(2)Field4 = Rs(3)Field5 = Rs(4)Sql1 = "insert Into User(ID, name, username, password, recdate)
Values(%26quot;%26amp;field1%26amp;%26quot; , '%26quot;%26amp;field2%26amp;%26quot;' , '%26quot;%26amp;field3%26amp;%26quot;' , '%26quot;%26amp;field4%26amp;%26quot;' , %26quot;%26amp;field5%26amp;%26quot;) %26quot;
Conn1.execute Sql1Rs.movenextI=i+1LoopRs.closeSet Rs=nothingConn.closeSet Conn=nothingConn1.closeSet Conn1=nothing

%%26gt;

Above is two to use the data that Php script and Asp script express to User to undertake arriving by Sql Server respectively of Mysql guide into meantime I use 2 kinds of evasive methods to avoid Ntext, of Image type data deliver,One kind is Nvarchar(4000) of Ntext field instead,Because of actual condition,The data length of this field in primitive data did not exceed 4000 words,Cut off without occurrence data so,Another method is Image kind data is taken in keeping a file,Save with file form,In putting file way the database,The method sees below:
Function Makeattach(fileContentType, filevalue, i)Select Case FileContentTypeCase "application/msword "Ext="doc "
Case "application/vnd.ms-excel "Ext="exl "
Case "application/vnd.ms-powerpoint "Ext="pps "
Case "application/x-rar-compressed "Ext="rar "
Case "application/x-zip-compressed "Ext="zip "
Case "image/gif "Ext="gif "
Case "image/pjpeg "Ext="jpg "
Case "text/plain "Ext="txt "
Case ElseExt="x "
End SelectIf Ext%26lt;%26gt;%26quot;x%26quot; ThenSet Fso=server.createobject("FileSystemObject" )FName=%26quot;attech%26quot;%26amp;i%26amp;%26quot; . "%26Amp;ext
Dir="d:aTtach "
If Fso.FileExists(Dir%26amp;FName) Then Fso.deletefile Dir%26amp;FName
If FName%26lt;%26gt;%26quot;%26quot; AND NOT Fso.FileExists(Dir%26amp;FName) Then
Set Strm1=Server.CreateObject("ADODB.Stream" )Strm1.OpenStrm1.Type=1 'BinaryStrm1.Write FilevalueStrm1.SaveToFile Dir%26amp;FName, 2
Set Strm1=NothingEnd IfMakeattach=fNameEnd IfEnd Function

This function has 3 inputs parameter,The first ContentType that is a file,The second binary system that is a file is numeric,The third is a variable that can distinguish file name,The suffixal name that puts a document certainly according to ContentType first,Save binary numerical value the file that designates file name namely next,Return file master to output parameter,The database middleman and guarantor that writes returned parameter Mysql as data is put.
Time is hurried,Sum up here first,Some help the person that hopes these characters can need to having,Take some of roundabout way less,Thank you read.:)

...

Install synchronism of MySql data

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 / Etc/mysql/my.cnf perhaps is in the My.cnf below 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:


...

MySQL optimizes compendious guideline

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 a 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 -fomit-frame-pointer%26quot; CXX=gcc CXXFLAGS=%26quot;-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti%26quot; . / Configure- - Prefix=/usr/local- - Enable-assembler- - With-mysqld-ldflags=-all-static- - Disable-shared
--------------------------------------------------------------------------------

...

Undertake data manipulation to MySQL with batch processing

Batch processing is a kind of method that is not seesaw pattern to run Mysql program,The order that uses in Mysql as you is same,You still will use these orders.
? ?
? ? to realize batch processing,You are heavy directional a file arrives in Mysql program,Above all we need document of a text,Bag of this text file contains the text version with the same command that inputs in Mysql with us.
For instance we should insert ? ? a few data,Use include below the file of text (file name is New_Data.sql, of course we are OK also entitle New_Data.txt reachs any other legal names,Differ compose Sql is terminal after wanting surely) :
? ? USE Meet_A_Geek;
? ? INSERT INTO Customers (Customer_ID, last_Name) VALUES(NULL, "Block");
? ? INSERT INTO Customers (Customer_ID, last_Name) VALUES(NULL, "Newton");
? ? INSERT INTO Customers (Customer_ID, last_Name) VALUES(NULL, "Simmons");
The grammar of these sentences above ? ? attention must be correct,And every sentence ends with semicolon.
The USE command above ? ? chooses a database,INSERT command inserts data.
? ?
We want to guide the file above below ? ? in the database,Before guiding, should affirm the database been movinging,It is Mysqld process namely (perhaps persuade Wu,Call below Windows NT " service " ,It is below Unix " process " ) having movinging.
? ? runs the command below next:
P of - of ? ? Bin/mysql%26lt;/ Home/mark/New_Data.sql
? ? inputs a password by clew then,If the statement in the file above does not have a mistake,So these data are guided in the database.
? ?
LOAD DATA INFILE uses to guide from inside the file data arrives in travel of ? ? command database:
You may ask ? ? oneself now,"After all why I should be inputted all these SQL statements in the file,Run them through the program next?"
? ? seems to need much work it seems that so.Very good,You wanted to be opposite probably so.But if you have,record from the Log of all generation in these commands?Now such very marvellous,Hum,The Log that most database can produce the incident in the database automatically to record.And major Log is included has used primitive SQL commands.Because of this,If you cannot from you derive data is used in new Mysql database in present database,So the batch processing that you can use Log and Mysql is characteristic,Come fast and guide conveniently your ground data.Of course,Such with respect to leave out typed trouble.
? ?
? ? LOAD DATA INFILE
? ? this is us those who want the introduction is the last guide data arrives the method in MySQL database.This command and Mysqlimport are very similar,But this method can command to be used in travel in Mysql.That is to say you are OK this order is used in the program of all use API.Use this kind of method,The data that in can using a program, you guide you want to guide.
? ?
Before ? ? uses this order,Mysqld process (service) must have movinging.
Command of the ? ? Mysql that start goes:
P of - of ? ? Bin/mysql
? ? inputs a password by clew,After entering Mysql command successfully to go,The command below the input:
? ? USE Meet_A_Geek;
? ? LOAD DATA INFILE "/home/mark/data.sql" INTO TABLE Orders;
? ? is told simply,Will guide the content in file Data.sql so in expressing Orders,Like Mysqlimport tool,The parameter that this command also has a few to be able to choose.The data that for instance you need to get on your computer guides in long-range database server,You can use the order below:
? ? LOAD DATA LOCAL INFILE "C:\MyDocs\SQL.txt" INTO TABLE Orders;
? ?
The file that the LOCAL parameter above ? ? shows to the file is this locality,The server is the server that you land.
? ? such with respect to leave out use Ftp will upload a file to the server,MySQL was finished for you.
You also can install ? ? the first step that inserts a statement,If you want to label it,be small first step (LOW_PRIORITY) ,So MySQL will when when reading this list without someone else,Just insert data.The order that can use as follows:
? ? LOAD DATA LOW_PRIORITY INFILE "/home/mark/data.sql" INTO TABLE Orders;
? ?
You also can appoint ? ? when whether inserting data,Replace or key is worth the reduplicative in oversight file and data table.The grammar that replaces reduplicative key cost:
? ? LOAD DATA LOW_PRIORITY INFILE "/home/mark/data.sql" REPLACE INTO TABLE Orders;
The sentence above ? ? looks a bit awakward,But put key word in what let you to analyse however implement understandable place.
? ?
The described a file to option format below ? ? ,These option also are what to can use is in in Mysqlimport tool.They differ a bit it seems that here.Above all,Should use FIELDS key word,If use this key word,MySQL is analysed implement the hope sees have an option below at least:
? ? TERMINATED BY Character
? ? ENCLOSED BY Character
? ? ESCAPED BY Character
It is same that these ? ? key word and their parameter follows the use in Mysqlimport. The
The separator of field of description of ? ? TERMINATED BY,Tab character is below acquiescent circumstance (\t)
The character since the draw together that what ? ? ENCLOSED BY describes is a field.Have each field with quote draw together for example.
The escape character that ? ? ESCAPED BY depicts.Acquiescent is to counter some of thick line (Backslash:\ ) .
The Mysqlimport jussive case in front still is used below ? ? ,Use statement of LOAD DATA INFILE to guide same document in the database:
? ? LOAD DATA INFILE "/home/mark/Orders.txt" REPLACE INTO TABLE Orders FIELDS TERMINATED BY ' , ' ENCLOSED BY '"';
? ?
There is a characteristic in there is tool of a Mysqlimport in statement of ? ? LOAD DATA INFILE:
? ? LOAD DATA INFILE can list a file to guide by what appoint in the database.
When the one part content that ? ? wants a data when us guides,This characteristic is very important.Say for example,When we should upgrade to MySQL database from Access database,Need adds a few columns (row / field / Field) in MySQL database,In order to get used to a few additional need.
? ? this moment,The data in our Access database remains practicable,But the column because of these data (in Field) and MySQL match no longer,Can no more use Mysqlimport tool because of this.Nevertheless,We still can use LOAD DATA INFILE,The example below showed how to designation column (guide in Field) data:
? ? LOAD DATA INFILE "/home/Order.txt" INTO TABLE Orders(Order_Number, order_Date, customer_ID);
? ?
? ? is seen like you,The column that we can appoint need (Fields) .The field that these designation still is with bracket draw together rises,By comma space,If you were omited among them any,MySQL will remind you
? ?
? ? Importing Data From Microsoft Access (guide from inside Access into data,Slightly)

...

Teach you how to apply MySQL safely

MySQL has been become one of most databases are used in current network,Go up in Web application especially,The absolutely dominant position that it held medium or small applying.All these results from its cabinet use easily, license of safe and effective, open mode and much platform,Mainer is it and one of languages of three big Web -- the perfect union of PHP.

But unfortunate is,The MySQL of safety of a default,Because Root password is sky and program flaw to bring about,can be spilled over,Make the server that installs MySQL becomes the target that often is atttacked.More serious is,After be being atttacked, the database often is destroyed,The consequence that makes cause disaster difficult sex easily.In what undertake to protect data will be being entered to guard battle below.

Environmental requirement

1 .Systematic environment

The server that a Red Hat Linux 9.0 defines installation oneself,The system installed GCC and package of a few software,For instance Apache, PHP.The first thing after installing a system upgrades namely systematic software is wrapped.As Web server,The plea that the system accepts PHP script,PHP is used below the contact that the MySQL database that will install releases as trends.

The requirement of divisional circumstance and average system are similar,The point with different only depends on from the back build / Chroot and / Tmp asks to be in same on partition.

2 .Safe requirement

(1) MySQL moves in to become independent (Chroot) below the environment;
(2) the user that Mysqld process runs at to become independent / below user group,This user and user group do not have a catalog,Without Shell,Also cannot use at other program;
(3) the Root Zhang date of modification MySQL,Use a complex code;
(4) allow MySQL of this locality join only,Join of the network when the MySQL that start is prohibited;
(5) the Nobody Zhang date that assures join MySQL logins to be prohibited;
(6) delete Test database.

Install MySQL

1 .Install preparation

Before installing MySQL,The user that needs to found to be used at starting MySQL according to afore-mentioned safe requirements and group.


...

How to make MySQL safety decodes ace with antagonism

Join when you when server of a MySQL,You should use a password normally.Countersign is not transmitted on join with proclaimed in writing.

All other information is transmitted as the text that can be understood by anybody.If you worry about this,You can be used compress an agreement (MySQL3.22 and above version) it is more difficult to make the thing becomes.Even to make everything safer,You should install Ssh (seeHttp://www.cs.hut.fi/ssh) .With it,You can get between server of a MySQL and client of a MySQL one adds close TCP/IP to join.

...

MySQL manages on Web:PhpMyAdmin is used explain

? ? 1. Hardware environment:
? ?
? ? hard disk:Memory of 9.2 G; :Net of 128 M; gets stuck:EEpor100
? ?
? ? 2. Software
? ?
? ? operating system:RedHat 6.2
? ?
? ? 3. Optimize RedHat 6.2
? ?
When ? ? is installed, choose
? ? Ftp and Dns
? ?
? ? compiles a document / Etc/hosts
? ?
? ? instead:
? ? 202.104.131.100 Info.langoit.com.cn Info
? ?
? ? compiles a document / Etc/named.conf
? ?
? ? instead:
? ?
? ? / / Generated By Named-bootconf.pl
? ?
? ? Options {
? ? Directory "/var/named";
? ? Forwarders {202.104.131.98;};
? ? Forwards Only;
? ? / / Query-source Address * Port 53;
? ? };
? ?
? ? / /
? ? / / A Caching Only Nameserver Config
? ? / /
? ? Zone " . ? ? Zone " .. In {
? ? Type Hint;
? ? File "named.ca";
? ? };
? ?
? ? Zone "0.0.127.in-addr.arpa" In {
? ? Type Master;
? ? File "named.local";
? ? };
? ?
? ?
? ? compiles a document / Etc/resolv.conf
? ?
? ? instead:
? ? Search Langoit.com.cn
? ? Nameserver 202.104.131.98
? ? Nameserver 202.96.134.133
? ?
? ? optimizes Linux kernel:
? ?
? ? deletes the Rpm that do not have to wrap:
? ?
? ? should stop the course that running above all
? ?
? ? Cd /etc/rc.d/init.d
? ?
? ? . / Sendmail Stop
? ? . / Apmd Stop
? ? . / Kudzu Stop
? ?
? ? Rpm -e- - Nodeps Sendmail Kudzu Nfs-utils
? ?
? ? compiles a document / Usr/src/linux/include/linux/tasks.h
? ?
? ? edits four the tenth (Vi +14) :
? ?
? ? NR_TASKS 5120---%26gt;3072
? ? MIN_TASKS_LEFT_FOR_ROOT 16---%26gt;24
? ?
? ? compiles a document / Usr/src/linux/Makefile
? ?
? ? edits eight the tenth (Vi +18) :
? ?
? ? HOSTCC =gcc
? ?---%26gt;
? ? HOSTCC =egcs
? ?
? ? edits the second ten the five elements (Vi +25) :
? ?
? ? CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
? ?---%26gt;
? ? CC =$(CROSS_COMPILE)egcs -D__KERNEL__ -I$(HPATH)
? ?
? ? edits ten the nineth (Vi +90) :
? ?
? ? CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
? ?---%26gt;
? ? CFLAGS = -Wall -Wstrict-prototypes -O9 -funroll-loops -ffast-math -malign-double -mcpu=
? ? Pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions
? ?
? ? edits nine the tenth (Vi +19) :
? ?
? ? HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
? ?---%26gt;
? ? HOSTCFLAGS =-Wall -Wstrict-prototypes -O9 -funroll-loops -ffast-math -malign-double -mcpu=
? ? Pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions
? ?
? ? installs a kernel:
? ?
? ? Make Xconfig
? ?
? ? is specific but oneself are installed according to the system
? ?
? ? is in / below Usr/src/linux/ catalog
? ?
? ? Make Dep
? ? Make Clean
? ? Make Bzlilo
? ? Make Modules
? ? Make Modules_install
? ?
? ? 4. Install and optimize Mm, mysql, apache, php, phpMyAdmin, perl, mode_perl
? ?
File of ? ? 1)
? ? Mm: Mm-1.1.3.tar.gz
? ? Mysql: Mysql-3.22.32.tar.gz
? ? Apache: Apache_1.3.12.tar.gz
? ? Php: Php-4.0.0.2.0.5.tar.gz
? ? PhpMyAdmin: PhpMyAdmin_2.0.5.tar.gz
? ? Mode_perl: Mod_perl-1.24.tar.gz
? ? Perl-DBI: DBI-1.14.tar.gz
? ? DBD-Oracle-1.06.tar.gz
? ? Msql-Mysql-modules-1.2214.tar.gz
? ? Data-Dumper-2.101.tar.gz
? ? Data-ShowTable-3.3.tar.gz
? ? Eperl: Eperl-2.2.14.tar.gz
? ? Perl: Perl-5.6.0.tar.gz
? ?
? ? solution controls a file:
? ?
Name of file of ? ? Tar -zxpf
? ?
? ? notices:The following all be compiled beforehand and below the software list that installation is wanting to install
? ?
? ? #) installs Mm
? ? . / Configure \
? ?- - Disable-shared \
? ?- - Prefix=/usr
? ? Make
? ? Make Test
? ? Make Install
? ? Make Clean
? ?
The installation of #) Mysql mixes ? ? configuration
? ?
? ? of #) Mysql compile beforehand
? ?
? ? CC="egcs" \
? ? OPTIM="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro \
? ? - March=pentiumpro -fomit-frame-pointer -fno-exceptions" \
? ? . / Configure \
? ?- - Prefix=/mysql \
? ?
? ? #) installs Mysql
? ?
? ? Make
? ? Make Install
? ? Make Clean
? ?
? ? #) configures Mysql
? ?
? ? / Mysql/bin/mysql_install_db
? ?
Database of ? ? initialization
? ? Cp /mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysql
? ? Cd /etc/rc.d/rc3.d
? ? Ln -s. . / Init.d/mysql S70mysql
? ?
Mysql of the to load when ? ? system is started
? ?
Of ? ? #) Apache compile beforehand
? ?
? ? CC="egcs" \
? ? OPTIM="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro \
? ? - March=pentiumpro -fomit-frame-pointer -fno-exceptions" \
? ? CFLAGS="-DDYNAMIC_MODULE_LIMIT=0" \
? ? . / Configure \
? ?- - Prefix=/apache \
? ?
Of ? ? #) Php compile beforehand
? ?
? ? CC="egcs" \
? ? OPTIM="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro \
? ? - March=pentiumpro -fomit-frame-pointer -fno-exceptions" \
? ? . / Configure \
? ?- - Prefix=/usr \
? ?- - With-apache= . . / Apache_1.3.12 \
? ?- - Enable-safe-mode \
? ?- - With-mm \
? ?- - Enable-inline-optimization \
? ?- - Enable-memory-limit \
? ?- - Enable-track-vars \
? ?- - With-mysql=/mysql \
? ?
? ? #) installs Php
? ?
? ? Make
? ? Make Install
? ? Make Clean
? ?
Of ? ? #) Mode_perl compile beforehand
? ?
? ? Perl Makefile.PL \
? ? EVERYTHING=1 \
? ? APACHE_SRC= . . / Apache_1.3.12/src \
? ? USE_APACI=1 \
? ? DO_HTTPD=1
? ?
? ? #) installs Mod_perl
? ?
? ? Make
? ? Make Install
? ? Make Clean
? ?
? ? #) compiles Apache
? ?
? ? EAPI_MM=SYSTEM \
? ? CC="egcs" \
? ? OPTIM="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro \
? ? - March=pentiumpro -fomit-frame-pointer -fno-exceptions" \
? ? CFLAGS="-DDYNAMIC_MODULE_LIMIT=0" \
? ? . / Configure \
? ?- - Prefix=/apache \
? ?- - Activate-module=src/modules/php4/libphp4.a \
? ?- - Enable-module=php4 \
? ?- - Activate-module=src/modules/perl/libperl.a \
? ?- - Enable-module=perl
? ?
? ? #) installs Apache
? ?
? ? Make
? ? Make Install
? ? Make Clean
? ?
? ? Cp /apache/bin/apachectl /etc/rc.d/init.d/httpd
? ? Cd /etc/rc.d/rc3.d
? ? Ln -s. . / Init.d/httpd S80httpd
? ?
Apache of the to load when ? ? system is started
? ?
? ? #) installs Eperl
? ?
? ? Perl Makefile.PL
? ?
? ? Make
? ? Make Test
? ? Make Install
? ? Make Clean
? ? - Frame-pointer -fno-exceptions" \
? ? CFLAGS="-DDYNAMIC_MODULE_LIMIT=0" \
? ? . / Configure \
? ?- - Prefix=/apache \
? ?- - Activate-module=src/modules/php4/libphp4.a \
? ?- - Enable-module=php4 \
? ?- - Activate-module=src/modules/perl/libperl.a \
? ?- - Enable-module=perl
? ?
? ? #) installs Apache
? ?
? ? Make
? ? Make Install
? ? Make Clean
? ?
? ? Cp /apache/bin/apachectl /etc/rc.d/init.d/httpd
? ? Cd /etc/rc.d/rc3.d
? ? Ln -s. . / Init.d/httpd S80httpd
? ?
Apache of the to load when ? ? system is started
? ?
? ? #) installs Eperl
? ?
? ? Perl Makefile.PL
? ?
? ? Make
? ? Make Test
? ? Make Install
? ? Make Clean
? ?
? ?
? ? Make
? ? Make Test
? ? Make Install
? ? Make Clean
? ? Make Clean

...

MySQL service safeguards note

Be aimed at what MySQL regards special database as the server to optimize a proposal namely below:

The program of MySQL server

To be safeguarded later,Upgrade the security of the convenience of backup and data,Had better install MySQL program document and data respectively in " different hardware " on.

         / /
| / Usr %26lt;==Operating system
| / Home/mysql %26lt;==Mysql advocate catalog,Upgrade to go to the lavatory,This
Hard disk 1==%26gt; | It is the link of catalog of a newest version
| / Home/mysql-3.23.54/ %26lt;==The Mysql /home/mysql catenary of newest version receives here
\ /home/mysql-old/ %26lt;==The Mysql of the old version that moves previously

/ / Data/app_1/ %26lt;==Applied data and the script that start
Hard disk 2==%26gt; | / Data/app_2/
\ /data/app_3/


Of the installation that MySQL serves and service start

The version that MySQL uses current STABLE commonly:

Do not use as far as possible- - With-charset= option,I feel With-charset is in only ability is useful when pressing alphabetical sort,What meeting logarithm occupies these option is migratory bring a lot of troubles.

Do not use Innodb as far as possible,Innodb basically is used at needing external key,The company level such as general affairs supports,Cost is level of volume of know exactly about sth of speed comparing MYISAM drop.

. / Configure- - Prefix=/home/mysql- - Without-innodbMakeMake Install

Of the service start and stop

1 is duplicate default Mysql/var/mysql arrives / below Data/app_1/ catalog.

2The starting script of MySQLD:Start_mysql.sh


...

The graph turns management MySQL is more relaxed

MySQL is server of database of SQL of Cheng of a true much user, multi-line,It is at present the most popular open source yardage occupies one of library servers.The data that comes from MySQL project shows,At present MySQL user has achieved 4 million.Everybody is hep, the Web site of use MySQL includes Yahoo, Finance, MP3.com, Motorola, NASA, Silicon Graphics and Texas Instruments to wait.

Generally speaking,The user uses MySQL with commanding the means of travel comes.A lot of users use graphical user interface all the time in Windows environment (GUI) will operate and manage a database,To commanding a means may be unaccustomed,And a lot of novices are to feel MySQL masters not easily more.Undertake administrative to MySQL database for convenient user,The project afoot that actually early already a few graphs turn user management,They are MySQL Control Center (MySQLCC) , MySQLGUI and PhpMyAdmin.In addition,The figure that use Red Hat also can finish pair of MySQL from the OpenOffice of the belt turns management.

Install MySQL

Before installation, setting and applied graph turn administrative tool,Should install good MySQL server above all.Use the following command to examined this machine to whether install MySQL:
# Rpm -qa | Grep MysqlMysql-server-3.23.54a-11Mysql-3.23.54a-11

The article is all example all comes true in Red Hat 9.0.In Red Hat 9.0,Can pass " software includes management " the program will install MySQL directly.Specific means is preexistence " add or delete software to wrap " interfacial pitch on " SQL database server " ,Choose in detail in " server of Mysql-server - MySQL and relevant file " ,Insert the second piece of CD next,The choice is updated can.Also can use Rpm command to undertake installing through going up from CD directly.Because MySQL server needs the support of Perl language,ability moves normally,When method of a kind of installation after be being used so,The need before installing MySQL installs Perl language and relevant software package first.

After installation is finished,Use the following command to start MySQL server:
#service Mysqld Start

MySQL after installation is finished,Defined Root of a super user beforehand,Countersign is empty.Any users all can use this user to join MySQL database undertakes operating from MySQL server this locality.Apparent this is very insecure,After so MySQL is started,Should install Root password instantly.Setting method is as follows:
#mysqladmin Password 'ylgui'

Installed a new code so:Ylgui.

Whether has MySQL server moved normally?Can undertake examining through enabling a client to carry program Mysql.Should use here above the password of the setting:
# Mysql -u Root -pylgui
Welcome To The MySQL Monitor. Commands End With; Or \g.
Your MySQL Connection Id Is 6 To Server Version: 3.23.54
Type 'help;' Or '\h' For Help. Type '\c' To Clear The Buffer.

Notice,There is blank space between parameter P and password.Screen can show have what database at present:


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