Feed on
Subscription

Release MySQL group to install script automatically 1

? ? 1. Script Install.sh is built below catalog of MySQL source code,In adding the code below to this script:
? ?
? ? # ! / Bin/bash
? ? #####################################################
? ? ## Title: ## of ? of ? of MySQL 4.1 Cluster Installation Script
? ? ## Version: ## of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of 1 ? ?
? ? ## Date: ## of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of 2004-11-11 ? ?
? ? ## Author: ## of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of Yipsilon ? ?
? ? ## Email: ## of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of Yipsilon@163.com ? ?
? ? ## License: ## of ? of ? of ? of ? of ? of General Public License (GPL)
? ? ## Copyright(c) 2004, yipsilon All Rights Reserved ##
? ? #####################################################
## of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ? of ChangeLog of ? of ? of ? of ? of ? of ? of ? of ? of ? ? ##
? ? #####################################################
## of ? of ? of ? of ? of ? of ? of ? of ? of ? of Installation Guide of ? of ? of ? of ? of ? of ? of ? ? ##
? of ? ? ## 1. Copy The Script File Into Mysql Source Path ##
? of ? ? ## 2. ## of ? of ? of ? of Change Script File's Permission To 755
? of ? ? ## 3. Execute It And Wait For. . . ## of ? of ? of ? of ? of ? of ? of ? ? ?
? ? #####################################################
? ? ############################################
? ? ######### MySQL Server Config ##############
? ? ############################################
? ? #Determine To Install MySQL Server
? ? #"0" Means Do Not Install Server Programs
? ? INST_SERVER=1
? ? #MySQL Installation Path
? ? INST_PATH="/usr/local/mysql "
? ? #Define The Ports Of MySQL Installation, intput Strings Of PORT With Whitespace Separated.
? ? #e.g. "3306 3307" Means Install Two MySQL Servers:
The First Server Will Be Installed To $INST_PATH/1 And Listen 3306 Port of ? of ? of ? ? # .
The Second Server Will Be Installed To $INST_PATH/2 And Listen 3307 Port of ? of ? of ? ? # .
? ? of ? ? # . . . . . .
? ? INST_PORTS="3306 "
? ? #The Management Server Information
? ? MGM_HOST="192.168.1.253 "
? ? MGM_PORT="2200 "
? ? ###########################################
? ? ######### MySQL Cluster Config ############
? ? ###########################################
? ? #Determine To Install Cluster
? ? #"0" Means Do Not Install Cluster Programs
? ? INST_CLUSTER=1
? ? #Define COMPUTERs In Config.ini, intput Strings Of HostName With Whitespace Separated.
? ? #The Id Attribute Is Auto Increment And Start With 1.
? ? #e.g. "192.168.1.253 192.168.252" Will Generate The Following Code
? of ? ? # [COMPUTER]
Id=1 of ? of ? of ? ? #
HostName=192.168.1.253 of ? of ? of ? ? #
? of ? ? # [COMPUTER]
Id=2 of ? of ? of ? ? #
HostName=192.168.1.252 of ? of ? of ? ? #
? ? COMPUTERS="192.168.1.253 192.168.1.252 "
? ? #Define MGMs In Config.ini, intput Strings Of HostName With Whitespace Separated.
? ? #e.g. "192.168.1.253 192.168.252" Will Generate The Following Code
? of ? ? # [MGM]
HostName=192.168.1.253 of ? of ? of ? ? #
? of ? ? # [MGM]
HostName=192.168.1.252 of ? of ? of ? ? #
? ? MGMS="192.168.1.253 "
? ? #Define DBs In Config.ini, intput Ids Of ExecuteOnComputer With Whitespace Separated.
? ? #e.g. "1 2" Will Generate The Following Code
? of ? ? # [DB]
ExecuteOnComputer=1 of ? of ? of ? ? #
? of ? ? # [DB]
ExecuteOnComputer=2 of ? of ? of ? ? #
? ? DBS="1 "
? ? #Define APIs In Config.ini, intput Ids Of ExecuteOnComputer With Whitespace Separated.
? ? #e.g. "1 0 1 2" Will Generate The Following Code
? of ? ? # [API]
ExecuteOnComputer=1 of ? of ? of ? ? #
? of ? ? # [API]
? of ? ? # [API]
ExecuteOnComputer=1 of ? of ? of ? ? #
? of ? ? # [API]
ExecuteOnComputer=2 of ? of ? of ? ? #
? ? APIS="1 0 2 2 "
? ? ######################################################################
? ? ########## Starting To Install Programs, do Not Modify Them! #########
? ? ######################################################################
? ? Echo "Starting To Install Programs "%26gt;Install.log
? ? #Find Installation Path
? ? If [$# -gt 0]
? ? Then
? ? INST_PATH="$1 "
? ? Else
? ? INST_PATH="/usr/local/mysql "
? ? Fi
? ? If [0 -lt $INST_SERVER]
? ? Then
? ? Echo "Now, installing The MySQL Servers. . . ..
? ?
? ? #Loop To Install Mysql Servers
? ? INSTALLED_SERVER_COUNT=1
? ? For PORT In $INST_PORTS
? ? Do
? ? #Define The Current Mysql Server Installation Path
? ? MYSL_PATH=$INST_PATH/$INSTALLED_SERVER_COUNT
? ?
? ? #Configure Mysql Server
? ? Echo "Exec. / Configure- - Prefix=$MYSL_PATH- - With-pthread- - With-unix-socket-path=$MYSL_PATH/var/mysql.sock- - With-mysqld-user=root- - With-tcp-port=$PORT- - With-charset=gbk- - With-ndbcluster%26quot; %26gt;%26gt;Install.log
? ? . / Configure- - Prefix=$MYSL_PATH- - With-pthread- - With-unix-socket-path=$MYSL_PATH/var/mysql.sock- - With-mysqld-user=root- - With-tcp-port=$PORT- - With-charset=gbk- - With-ndbcluster
? ?
? ? #Make Mysql Server
? ? Echo %26quot;Exec Make %26amp;%26amp;Make Install%26quot; %26gt;%26gt;Install.log
? ? Make %26amp;%26amp;Make Install
? ?
? ? #Create Var Directory For Mysql Data
? ? Mkdir -p $MYSL_PATH/var
? ?
? ? #Create My.cnf
? ? Echo %26quot;Create $MYSL_PATH/var/my.cnf%26quot; %26gt;%26gt;Install.log
? ? Echo "[client] "%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;port=$PORT%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;socket=$MYSL_PATH/var/mysql.sock%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;[mysqld]%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;ndbcluster%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo "ndb_connectstring=host=$MGM_HOST:$MGM_PORT%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;user=root%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;port=$PORT%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;basedir=$MYSL_PATH/%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;datadir=$MYSL_PATH/var/%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;socket=$MYSL_PATH/var/mysql.sock%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;default-character-set=gbk%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;default-storage-engine=INNODB%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;max_connections=500%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;query_cache_size=33M%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;table_cache=1520%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;tmp_table_size=16M%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;thread_cache=38%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;#MyISAM Specific Options%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;#skip-myisam%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;#INNODB Specific Options%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Echo %26quot;#skip-innodb%26quot; %26gt;%26gt;$MYSL_PATH/var/my.cnf
? ? Chmod 755 $MYSL_PATH/var/my.cnf
? ?
? ? #Install Mysql Database
? ? Echo %26quot;Exec $MYSL_PATH/bin/mysql_install_db%26quot; %26gt;%26gt;Install.log
? ? $MYSL_PATH/bin/mysql_install_db
? ?
? ? #Create Mysql Control Script
? ? If [-e $MYSL_PATH/share/mysql/mysql.server]
? ? Then
? ?
? ? #Use Default Mysql Control Script
? ?
? ? #Create Mysql Server Start Script
? ? Echo %26quot;Create $MYSL_PATH/start%26quot; %26gt;%26gt;Install.log
? ? Echo "$MYSL_PATH/share/mysql/mysql.server Start "%26gt;$MYSL_PATH/start
? ? Echo %26quot;Chmod 755 $MYSL_PATH/start%26quot; %26gt;%26gt;Install.log
? ? Chmod 755 $MYSL_PATH/start
? ?
? ? #Create Mysql Server Stop Script
? ? Echo %26quot;Create $MYSL_PATH/stop%26quot; %26gt;%26gt;Install.log
? ? Echo "$MYSL_PATH/share/mysql/mysql.server Stop "%26gt;$MYSL_PATH/stop
? ? Echo %26quot;Chmod 755 $MYSL_PATH/stop%26quot; %26gt;%26gt;Install.log
? ? Chmod 755 $MYSL_PATH/stop
? ?
? ? #Create Mysql Server Restart Script
? ? Echo %26quot;Create $MYSL_PATH/restart%26quot; %26gt;%26gt;Install.log
? ? Echo "$MYSL_PATH/share/mysql/mysql.server Restart "%26gt;$MYSL_PATH/restart
? ? Echo %26quot;Chmod 755 $MYSL_PATH/restart%26quot; %26gt;%26gt;Install.log
? ? Chmod 755 $MYSL_PATH/restart
? ? Else
? ?
? ? #Use Custom Mysql Control Script
? ?
? ? #Create Mysql Server Start Script
? ? Echo %26quot;Create $MYSL_PATH/start%26quot; %26gt;%26gt;Install.log
? ? Echo %26quot;$MYSL_PATH/libexec/mysqld %26amp; %26quot;%26gt;$MYSL_PATH/start
? ? Echo %26quot;Chmod 755 $MYSL_PATH/start%26quot; %26gt;%26gt;Install.log
? ? Chmod 755 $MYSL_PATH/start
? ?
? ? #Create Mysql Server Stop Script
? ? Echo %26quot;Create $MYSL_PATH/stop%26quot; %26gt;%26gt;Install.log
? ? Echo "$MYSL_PATH/bin/mysqladmi

...

Of MYSQL study data make mistake code list

? ? 1005:Found watch failure
? ?
? ? 1006:Found database failure
? ?
? ? 1007:The database already existed,Found database failure
? ?
? ? 1008:The database is nonexistent,Cutout fails except the database
? ?
? ? 1009:Cannot delete database file to bring about cutout to fail except the database
? ?
? ? 1010:Cannot delete data catalog to bring about cutout to fail except the database
? ?
? ? 1011:Cutout fails except database file
? ?
? ? 1012:Cannot read the record in taking a system to express
? ?
? ? 1020:The record already was revised by other user
? ?
? ? 1021:The space is not worth hard disk the rest,Increase hard disk to be able to use a space please
? ?
? ? 1022:Key word repeats,Change record failure
? ?
? ? 1023:The mistake happens when shutting
? ?
? ? 1024:Read file mistake
? ?
? ? 1025:The mistake happens when changing a name
? ?
? ? 1026:Write file mistake
? ?
? ? 1032:The record is nonexistent
? ?
? ? 1036:Data table is read-only,Cannot undertake modification to it
? ?
? ? 1037:Systematic memory is insufficient,Restart please database or restart server
? ?
? ? 1038:At the memory inadequacy of sort with,Increase sort buffer please
? ?
? ? 1040:The biggest join that already arrived at a database is counted,Increase a database to be able to use join number please
? ?
? ? 1041:Systematic memory is insufficient
? ?
? ? 1042:Invalid leader name
? ?
? ? 1043:Invalid join
? ?
? ? 1044:Current user did not visit the attributive of the database
? ?
? ? 1045:Cannot join database,User name or password are wrong
? ?
? ? 1048:The field cannot is empty
? ?
? ? 1049:The database is nonexistent
? ?
? ? 1050:Data table already existed
? ?
? ? 1051:Data table is nonexistent
? ?
? ? 1054:The field is nonexistent
? ?
? ? 1065:Invalid SQL statement,SQL statement is empty
? ?
? ? 1081:Cannot establish Socket link
? ?
? ? 1114:Data list is full already,Cannot hold any records
? ?
? ? 1116:The data table that open is too much
? ?
? ? 1129:The database appears unusual,Restart please database
? ?
? ? 1130:Join database fails,Without the attributive of join database
? ?
? ? 1133:Database user is nonexistent
? ?
? ? 1141:Current user has no right to visit a database
? ?
? ? 1142:Current user has no right to visit data table
? ?
? ? 1143:Current user has no right to visit data to express medium field
? ?
? ? 1146:Data table is nonexistent
? ?
? ? 1147:Did not define the visit limits of authority that the user expresses to data
? ?
? ? 1149:SQL statement solecism
? ?
? ? 1158:Network mistake,Occurrence misread by accident,Inspect network join condition please
? ?
? ? 1159:Network mistake,Read overtime,Inspect network join condition please
? ?
? ? 1160:Network mistake,Occurrence clerical error by accident,Inspect network join condition please
? ?
? ? 1161:Network mistake,Write overtime,Inspect network join condition please
? ?
? ? 1062:Field value repeats,Put in storage fails
? ?
? ? 1169:Field value repeats,Newer record fails
? ?
? ? 1177:Open data to express failure
? ?
? ? 1180:Refer clerical failure
? ?
? ? 1181:Time roll clerical failure
? ?
? ? 1203:The biggest join that the link that current user and database establish already arrived at a database is counted,Increase practicable database to join is counted or restart please database
? ?
? ? 1205:Add lock overtime
? ?
? ? 1211:Current user did not establish the limits of authority of the user
? ?
? ? 1216:External key tie examines failure,Newer child souvenir records failure
? ?
? ? 1217:External key tie examines failure,Delete or revise advocate souvenir records failure
? ?
? ? 1226:The resource that the resource that current user uses already allowed more than,Restart please database or restart server
? ?
? ? 1227:Attributive is insufficient,You have no right to undertake this is operated
? ?
? ? 1235:MySQL version is too low,Do not have this function

...

The extraction of all sorts of fields of the MySQL in the database is worth limits

? ? TINYINT
? ?
? ? - 128 - 127
? ?
? ? TINYINT UNSIGNED
? ?
? ? 0 - 255
? ?
? ? SMALLINT
? ?
? ? - 32768 - 32767
? ?
? ? SMALLINT UNSIGNED
? ?
? ? 0 - 65535
? ?
? ? MEDIUMINT
? ?
? ? - 8388608 - 8388607
? ?
? ? MEDIUMINT UNSIGNED
? ?
? ? 0 - 16777215
? ?
? ? INT or INTEGER
? ?
? ? - 2147483648 - 2147483647
? ?
? ? INT UNSIGNED or INTEGER UNSIGNED
? ?
? ? 0 - 4294967295
? ?
? ? BIGINT
? ?
? ? - 9223372036854775808 - 9223372036854775807
? ?
? ? BIGINT UNSIGNED
? ?
? ? 0 - 18446744073709551615
? ?
? ? FLOAT
? ?
? ? - 3.402823466E+38 - -1.175494351E-38
? ?
? ? 0
? ?
? ? 1.175494351E-38 - 3.402823466E+38
? ?
? ? DOUBLE or DOUBLE PRECISION or REAL
? ?
? ? - 1.7976931348623157E+308 - -2.2250738585072014E-308
? ?
? ? 0
? ?
? ? 2.2250738585072014E-308 - 1.7976931348623157E+308
? ?
? ? DECIMAL[(M, [D])] or NUMERIC(M, d)
? ?
? ? by the length of M(whole number, include decimally, the digit of decimally left, the digit of decimally right, but do not include negative sign) the digit with D(decimally right) will decide, m default is 10, d default is 0
? ?
? ? DATE
? ?
? ? 1000-01-01 - 9999-12-31
? ?
? ? DATETIME
? ?
? ? 1000-01-01 00:00:00 - 9999-12-31 23:59:59
? ?
? ? TIMESTAMP
? ?
? ? 1970-01-01 00:00:00 - 2037 year one of these day (specific it is I also do not know where day, ah)
? ?
? ? TIME
? ?
? ? - 838:59:59' To 838:59:59
? ?
? ? YEAR[(2 | 4) ]
? ?
? ? default is 4 formats, 4 formats take value scope to be 1901 - 2155, 0000, 2 formats take value scope to be 70-69(1970-2069)
? ?
? ? CHAR(M) [BINARY] or NCHAR(M) [BINARY]
? ?
The limits of ? ? M is 1 - 255, if do not have BINARY, do not distribute big small letter, NCHAR expresses to use default character set. In the database with blank space complemental, but last when be taken blank space will be automatic take out.
? ?
? ? [NATIONAL] VARCHAR(M) [BINARY]
? ?
The limits of ? ? M is 1 - 255. Last in the database blank space will be automatic take out.
? ?
? ? TINYBLOB or TINYTEXT
? ?
? ? 255(2^8-1) character
? ?
? ? BLOB or TEXT
? ?
? ? 65535(2^16-1) character
? ?
? ? MEDIUMBLOB or MEDIUMTEXT
? ?
? ? 16777215 (2^24-1) character
? ?
? ? LONGBLOB or LONGTEXT
? ?
? ? 4294967295 (2^32-1) character
? ?
? ? ENUM('value1' , 'value2' , . . . ..
? ?
? ? always can share 65535 different costs
? ?
? ? SET('value1' , 'value2' , . . . ..

...

MySQL:How to install a password for the user

? ? is become the first time when Mysql is installed on the machine, you are OK and faceless undertake visitting a database to perhaps enter a database with bringing the Root capacity of countersign. Additional if you are an administrator, you have a few users even build reach accredit, this involves the issue that sets a password again. We discuss how to install a password below:
? ?
? ? above all the countersign memory that we should know Mysql database is medium must be added with Password() function close it. Because be in User watch,store in order to add close form countersign, is not to serve as simple text. If you were not added close, carry out the following statement in the database directly:
? ?
? ? Use Mysql
? ?
? ? Insert Into User (host, user, password) Values('%' , 'user_name' , 'your Password');
? ?
? ? Flush Privileges;
? ?
? ? believes the result won't make you satisfactory. Because the server is relative,be to increase close cost, so server join fails certainly. What the specification needs here is Flush Privileges; table of accredit of new to load reached since this command. You also can fall to use Mysqladmin -u Root Reload directly in Shell or Mysqladmin -u Root Flush-privileges will realize burden accredit watch.
? ?
? ? falls in Mysql environment, you can use the following statement to undertake installing a password:
? ?
? ? 1.insert Into User(host, user, password) Values('%' , 'user_name' , password("your Password");
? ?
? ? 2.set Password For User_name = Password("your Password" )
? ?
Two kinds of methods must undertake ? ? above burden accredit watch.
? ?
? ? 3. The password is installed directly when you also are founding an user of course, grant statement will add close countersign automatically for you.
? ?
? ? is like Grant All On * . * To User_name@% Identified By "your Password";
? ?
Additionally you also can be in ? ? the password is installed below Shell environment with Mysqladmin program
? ?
? ? is like Mysqladmin -u Root Password "your Password "

...

The MySQL UDF on Windows develops application

The BUG that ? ? ever thought the MySQL existence of Windows version cannot use UDF all referred a Bug to report.Discovering it seems that nevertheless is I made a mistake,The technical support staff of MySQL gave very perfect solve,Commensurate home is shared.Below is textual reply.
? ?
? ? user hello.Feel sorry,This is not a Bug.Below I am stickup the brief example that makes for a certain client before,Assume you had VC++ , the source is distributed,The MySQL server that and have moves normally.
? ?
? ? my general founds an UDF it a name:
? ?
? ? notices: ?oil up of bud of Sun of illicit of Lin of fawn on of live abroad of health neon of ? of ? of Ke of ? Yong shallow < not ? Xing sluggish returns ? DF.
? ?
? ? - open area of Mysqld.dsw work.
? ?
? ? - add new project to this work area
? ?
? ? - Project Name: Name of project of My_udf // : MY_udf
? ?
? ? - dynamic link library of choice Win32 Dynamic-Link Library // Win32
? ?
? ? - click OK
? ?
? ? - choose An Empty DLL Project // project of an empty DLL
? ?
? ? - click Finish
? ?
? ? - click OK
? ?
? ? - in adding new document My_udf.cpp to the project:
? ?
? ? #include
? ?
? ? #include
? ?
? ? #include
? ?
? ? Extern "C" {
? ?
? ? Char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
? ?
? ? Char *error);
? ?
? ? / / compatible C
? ?
? ? }
? ?
? ? Char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
? ?
? ? Char *error)
? ?
? ? {
? ?
? ? Char * Me = "my Name";
? ?
? ? Return Me;
? ?
? ? / / call this UDF to will return My Name
? ?
? ? }
? ?
? ? - will found a new document by Ctrl+N.
? ?
? ? - type of choice Text
? ?
? ? - File Name: Name of My_udf.def File:// file: MY_udf.def
? ?
? ? - compile a document according to the content of below.
? ?
? ? LIBRARY UDF_EXAMPLE
? ?
? ? DESCRIPTION 'Example Using UDF With VC++'
? ?
? ? VERSION 1.0
? ?
? ? EXPORTS
? ?
? ? My_name
? ?
? ? - right attack My_udf project and choose Settings
? ?
? ? - option of dot C/C++ gets stuck
? ?
? ? - choose General
? ?
? ? - add grand HAVE_DLOPE arrives pretreatment implement definition
? ?
? ? - choose Preprocessor
? ?
? ? - add head file way: Additional Include Directories
? ?
? ? for example: . . / Include
? ?
? ? - go compiling DLL by F7.
? ?
? ? - the list that duplicate My_udf.dll has defined to environmental variable Path
? ?
? ? for instance \winnt\system32.
? ?
? ? - open Mysql client end
? ?
? ? C:\Mysql-udf\bin%26gt;mysql -uroot -p
? ?
? ? Enter Password:
? ?
? ? Welcome To The MySQL Monitor. Commands End With; Or \g.
? ?
? ? Your MySQL Connection Id Is 2 To Server Version: 3.23.52-max-nt
? ?
? ? Type 'help;' Or '\h' For Help. Type '\c' To Clear The Buffer.
? ?
? ? Mysql%26gt;CREATE FUNCTION My_name RETURNS STRING SONAME "my_udf.dll";
? ?
? ? Query OK, 0 Rows Affected (0.08 Sec)
? ?
? ? Mysql%26gt;Select My_name();
? ?
? ? Mysql%26gt;Drop Function My_name;
? ?
? ? Query OK, 0 Rows Affected (0.00 Sec)
? ?
The letter in reply that MySQL technology personnel is under ? ? is textual:
? ?
? ? Sorry This Isn't A Bug.
? ?
? ? Below I Pasted A Sample I Did Sometime Ago For Another User:
? ?
? ? Ok. Assuming You Have VC++ And The Source Distribution And A Server
? ?
? ? Running,
? ?
? ? I Will Create A UDF That Returns A Name:
? ?
? ? Note: The Sample Is Ugly, but The Purpose Here Is To Show You How
? ?
? ? To Handle The UDF.
? ?
? ? - Open The Mysqld.dsw Workspace.
? ?
? ? - Add New Project To The Workspace
? ?
? ? - Project Name: My_udf
? ?
? ? - Select Win32 Dynamic-Link Library
? ?
? ? - Click OK
? ?
? ? - Select An Empty DLL Project
? ?
? ? - Click Finish
? ?
? ? - Click OK
? ?
? ? - Add A New File Called My_udf.cpp To The Project:
? ?
? ? #include
? ?
? ? #include
? ?
? ? #include
? ?
? ? Extern "C" {
? ?
? ? Char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
? ?
? ? Char *error);
? ?
? ? }
? ?
? ? Char *my_name(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
? ?
? ? Char *error)
? ?
? ? {
? ?
? ? Char * Me = "my Name";
? ?
? ? Return Me;
? ?
? ? }
? ?
? ? - Type Ctrl+N For To Create A New File.
? ?
? ? - Select Text Type
? ?
? ? - File Name: My_udf.def
? ?
? ? - Edit The Above File With The Below Contents:
? ?
? ? LIBRARY UDF_EXAMPLE
? ?
? ? DESCRIPTION 'Example Using UDF With VC++'
? ?
? ? VERSION 1.0
? ?
? ? EXPORTS
? ?
? ? My_name
? ?
? ? - Right Click The My_udf Project And Select Settings
? ?
? ? - Click The C/C++ Tab
? ?
? ? - Select General In The Category Combo
? ?
? ? - Add The Macro HAVE_DLOPEN To The PreProcessor Definition
? ?
? ? - Select Preprocessor In The Category Combo
? ?
? ? - Add The Include Path To The Text Box: Additional Include Directories
? ?
? ? E.g: . . / Include
? ?
? ? - Press F7 For To Build The DLL.
? ?
? ? - Copy The My_udf.dll To The Environment Path Directory:
? ?
? ? \winnt\system32 For Example.
? ?
? ? - Start The Mysql Client And Issue:
? ?
? ? C:\Mysql-udf\bin%26gt;mysql -uroot -p
? ?
? ? Enter Password:
? ?
? ? Welcome To The MySQL Monitor. Commands End With; Or \g.
? ?
? ? Your MySQL Connection Id Is 2 To Server Version: 3.23.52-max-nt
? ?
? ? Type 'help;' Or '\h' For Help. Type '\c' To Clear The Buffer.
? ?
? ? Mysql%26gt;CREATE FUNCTION My_name RETURNS STRING SONAME "my_udf.dll";
? ?
? ? Query OK, 0 Rows Affected (0.08 Sec)
? ?
? ? Mysql%26gt;Select My_name();
? ?
? ? Mysql%26gt;Drop Function My_name;
? ?
? ? Query OK, 0 Rows Affected (0.00 Sec)

...

The MySQL that settles way forgets super user countersign

? ? if MySQL is moving,Kill above all:Killall -TERM Mysqld.
? ?
? ? starts MySQL:Bin/safe_mysqld- - Skip-grant-tables %26amp;
? ?
? ? need not need a password to enter MySQL.
? ?
? ? is next
? ?
? ? %26gt; Use Mysql
? ?
? ? %26gt; Update User Set Password=password(%26quot;new_pass%26quot;) Where User=%26quot;root%26quot;;
? ?
? ? %26gt; Flush Privileges;
? ?
? ? kills MySQL afresh,Start MySQL with regular method.

...

Learn command of MySQL commonly used operation

1, server of the MySQL that start

Actual before last piece already told how to start MySQL.Two kinds of methods:It is with Winmysqladmin,If the machine is started when move automatically already,Can enter next operations directly.Two it is in DOS means issues moving D:mYsqlbinmysqld

2, enter Mysql to operate an interface interactively

Below DOS means,Move:D:mYsqlbinmysql

Appear: The clew accord with of Mysql,The alternant mode of operation that already entered Mysql right now.

If appear "ERROR 2003: ' of Localhost of ' of Can ' T Connect To MySQL Server On (10061) " ,

The MySQL that shows you has not been started.

3, exit MySQL to operate an interface

Quit is inputted to be able to exit alternant operation interface at any time below Mysql%26gt; clew accord with:Mysql%26gt;Quit
Bye
You also can be exited with Control-D.

4, the first command


...

MySQL expresses memory structure function two kinds to check a process quite

MyISAM of format of memory of two kinds of when MySQL supports main watches,InnoDB,When making an item last month,Used InnoDB first,Result rate is particularly slow,1 second can insert a few 10 only.Change MyISAM pattern later,One second inserts on ten thousand.The function of these two watches that become aware at that time also the difference is too big.Oneself are conjectural later,Not should the difference is so slow,Estimation is written insertion the statement has a problem,The decision does a test:

Test environment:Redhat Linux9,4CPU,Memory 2G,MySQL version is 4.1.6-gamma-standard

Test program:Module of Python + Python-MySQL.

Test program:

1, MyISAM format checks respectively,General affairs and need not general affairs two kinds of circumstances:

2, InnoDB format checks AutoCommit = respectively 1 (need not Begin Transaction and with Begin Transaction mode) ,

AutoCommit=0 (need not Begin Transaction and with Begin Transaction mode) four kinds of circumstances.

Test method is recorded to insert 10000.For the test not interact,Built appropriative to check a watch alone,The statement that build a list is as follows:

1, MyISAM is not expressed with general affairs:

CREATE TABLE `MyISAM_NT` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=MyISAM;

2, MyISAM expresses with general affairs:

CREATE TABLE `MyISAM_TS` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=MyISAM;

3, InnoDB shuts AutoCommit,Need not general affairs:

CREATE TABLE `INNODB_NA_NB` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=InnoDB;

4, InnoDB shuts AutoCommit,With general affairs:

CREATE TABLE `INNODB_NA_BE` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=InnoDB;

5, InnoDB open AutoCommit,Need not general affairs:

CREATE TABLE `INNODB_AU_NB` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=InnoDB;

6, InnoDB open AutoCommit,With general affairs:

CREATE TABLE `INNODB_AU_BE` (

`TableId` Int(11) NOT NULL Default '0' ,

`TableString` Varchar(21) NOT NULL Default ''

) ENGINE=InnoDB;

The Python script of the test is as follows:

# ! / Usr/bin/env Python

'''

MyISAM, innoDB function is compared

Author:Hollow dish (Invalid)

Time: 2004-10-22

'''
Import MySQLdb
Import Sys
Import Os
Import String
Import Time
C = None
Testtables = [("MyISAM_NT" , none, 0) ,

("MyISAM_TS" , none, 1) ,

("INNODB_NA_NB" , 0, 0) ,

("INNODB_NA_BE" , 0, 1) ,

("INNODB_AU_NB" , 1, 0) ,

("INNODB_AU_BE" , 1, 1)

1)
Def BeginTrans() :
Print "ExecSQL:BEGIN; "
C.execute("BEGIN;" )
Return
Def Commit() :
Print "ExecSQL:COMMIT; "
C.execute("COMMIT;" )
Return
Def AutoCommit(flag) :
Print "ExecSQL:SEt AUTOCOMMIT = "+str(flag)
C.execute("Set AUTOCOMMIT = "+str(flag) )
Return
Def Getcount(table) :

#print "ExecSQL:sElect Count(*) From "+table
C.execute("select Count(*) From "+table)
Return C.fetchall()[0][0]
Def AddTable (Table, tableId, tableString) :
Sql = "INSERT INTO "+Table+"(TableId, tableString) VALUES("+ TableId+ " , '" + TableString +"') "
Try:
C.execute(sql)
Except MySQLdb.OperationalError, error:
Print "AddTable Error:" , error
Return -1;
Return C.rowcount
Def Main() :
Argv = Sys.argv
If Len(argv)%26lt;2:
Print 'Usage:', argv[0] , ' TableId TestCount \n'
Sys.exit(1)
Global C #mysql visits Cursor
Db_host = "localhost "
Db_name = "demo "
Db_user = "root "
Db_user_passwd = " "
Print "Config:[%s %s/%s %s] DB\n"%(db_host, db_user, db_user_passwd, db_name)
If Len(argv)%26gt;2:
Tableid = Argv[1]
Testcount = Int(argv[2]) #
For Test In Testtables:

Before # is operated every time, rescript establish database link
Try:
Mdb = MySQLdb.connect(db_host, db_user, db_user_passwd, db_name)
Except MySQLDb.OperationalError, error:
Print "Connect Mysql[%s %s/%s %s] DB Error:" %(db_host, db_user, db_user_passwd, db_name) , error, "\n "
Sys.exit(1)
Else:
C = Mdb.cursor()
Table, autocommit, trans = Test
Starttime = Time.time()
Print Table, "" , time.strftime("%y-%m-%d %H:%M:%S" , time.localtime() )
If Autocommit! = None:

AutoCommit(autocommit)
If Trans==1:

BeginTrans()
For I In Xrange(testcount) :
Tablestring = "%020d"%i
If (AddTable(table, tableid, tablestring)%26lt;1) :
Print "AddTable Error" , tablestring
If Trans==1:

Commit()
Print Time.strftime("%y-%m-%d %H:%M:%S" , time.localtime() )
Endtime = Time.time()
Usedtime = Endtime-starttime
Print Table, "Count:" , getcount(table) , "Used Time:" , usedtime
C.close()
Mdb.close()
If __name__=='__main__' :
Main()

The test is as follows as a result:

Config:[Localhost Root/ Demo] DB

MyISAM_NT 04-10-22 16:33:24

04-10-22 16:33:26

MyISAM_NT Count: 10000 Used Time: 2.1132440567

MyISAM_TS 04-10-22 16:33:26

ExecSQL:BEGIN;

ExecSQL:COMMIT;

04-10-22 16:33:29

MyISAM_TS Count: 10000 Used Time: 2.65475201607

INNODB_NA_NB 04-10-22 16:33:29

ExecSQL:SEt AUTOCOMMIT = 0

04-10-22 16:33:31

INNODB_NA_NB Count: 10000 Used Time: 2.51947999001

INNODB_NA_BE 04-10-22 16:33:31

ExecSQL:SEt AUTOCOMMIT = 0

ExecSQL:BEGIN;

ExecSQL:COMMIT;

04-10-22 16:33:35

INNODB_NA_BE Count: 10000 Used Time: 3.85625100136

INNODB_AU_NB 04-10-22 16:33:35

ExecSQL:SEt AUTOCOMMIT = 1

04-10-22 16:34:19

INNODB_AU_NB Count: 10000 Used Time: 43.7153041363

INNODB_AU_BE 04-10-22 16:34:19

ExecSQL:SEt AUTOCOMMIT = 1

ExecSQL:BEGIN;

ExecSQL:COMMIT;

04-10-22 16:34:22

INNODB_AU_BE Count: 10000 Used Time: 3.14328193665

Conclusion:

The main reason that is informed influence speed from this is AUTOCOMMIT acquiescent setting is open,

My program at that time is done not have explicit call BEGIN; to begin work,Bring about every to insert an automatic Commit,Affected rate badly.

Calculate coming also is an elementary mistake!

Relevant reference:
Http://dev.mysql.com/doc/mysql/en/COMMIT.html
Http://dev.mysql.com/doc/mysql/en/InnoDB_and_AUTOCOMMIT.html

...

MySQL security guideline (1)

As the systematic manager of a MySQL,You are responsible the data security of the MySQL database system that maintains you and integrality.The MySQL system that the article basically basically introduces how to build a safety,From systematic interior and exterior network two angle,Provide a guide for you.

The issue that the article basically considers following security to concern:

Why security is very important,You should be on guard those attack?
The risk that the server faces (internal security) ,How to handle?
The client of join server carries a risk (external security) ,How to handle?
MySQL manager is responsible the security that assures database content,Make these data logging can be visited by the user of those proper authorization only,The internal security that this involves database system and external security.
The problem that what internal security cares is file system level,Namely,Avoid MySQL data list (DATADIR) by the person that there is Zhang number in server lead plane (lawful or of filch) have charge.If the attributive of data catalog content is beyond the mark,award,Make the document that everybody all replaces correspondence can simply to be expressed at those databases,So the accredit watch setting that ensures control client is visited through the network is proper,Insignificant to this fine long hair.

What external security cares is from exterior through the problem of the client of network join server,Namely,Protective MySQL server is avoided suffer come from atttack to the connective of the server through the network.You must install MySQL accredit to express (Grant Table) ,Make the database content that they do not allow to visit server management,Unless offer effective user name and word of command.

How does detailed introduction install file system and accredit watch Mysql below,The two class security that achieves MySQL.


One, internal security - the safety that makes sure data catalog is visited
MySQL server provided a flexible attributive system through the accredit watch in MySQL database.The content that you can set these tables,The visit that allow or rejects client logarithm to occupy a library,This offerred you to prevent not the safe method that the network visit of accredit atttacks to your database,If other user can be direct on lead plane,visit data catalog content however,Build the good security that visits a database to carrying a network to be without a help to you,The exclusive user that unless you know you are entry MySQL server,runs main engine,Otherwise the possibility of the visit that you need to care the other user on this machine to obtain logarithm to occupy catalog.

It is the content that you should protect below:

Database file.Apparently,The illicit of the database that you want to defend server management uses a sex.Database owner normally and the security that should consider database content,Although they do not think,Be brought into the public of content of the database when also should considering,The security that is not the data list that carries how terrible will expose these content.
Log file.Must assure safety with newer daily record commonly,Because they include inquiry text version.The operation that the one that has visit limits of authority to log file can monitor the database has undertaken.
The log file security that should consider mainly more is such as GRANT and SET PASSWORD the inquiry that wait also by account,The text version that contains sensitive inquiry with bag of newer daily record commonly,Include countersign (MySQL use countersign is added close,But it just is applied after had finished a setting build at the following join.The inquiry such as the GRANT of course design elephant that installs a countersign or SET PASSWORD,And these inquire be with account of common text form in log file) .If an aggressor is just as day of file read attributive,Need to run Grep to search the word such as such as GRANT and PASSWORD to discover sensitive information on log file only.
Apparent,You do not want to let what the other user on server lead plane has database catalog file write attributive,Because they can rescript,your condition file or database express a file,But it is very dangerous also to read attributive.If a database expresses a file to be able to be read,take,Take a file secretly and get MySQL itself,The content that shows a list with common text is very troublesome also,Why?Because you want to do following business:

Yourself is installed on server lead plane " tailor-made " MySQL server,But word of the port that one is different from official server version, dowel joint and data catalog.
Moving Mysql_install_db initialization your data catalog,This gifts the attributive of the server that you regard MySQL Root user as to visit you,The complete control that so you have pair of servers to visit a mechanism,It also builds database of a Test.
The Test catalog below the database list that considers correspondence to obtain watch file to copy your server secretly at you.
The server that starts you.You can visit a database to express at will,The copy that SHOW TABLES FROM Test shows to you have a list that comes secretly,The entire content that SELECT * shows their any.
If you really very evil-minded,any faceless users that attributive gives you publicly the server,Such anybody can from the Test database that joins the server visits you anyplace.You publish the database list that comes secretly now at numerous.

...

In MySQL database use C carries out SQL statement

With PostgreSQL likeness,The language that can use a lot of differring will visit MySQL,Include C, C++ , Java and Perl.What concern MySQL from the 5th chapter in Professional Linux Programming is following and paragraphic in,Neil Matthew and Richard Stones used detailed MySQL C interface to introduce how to carry out SQL statement in MySQL database to us.They will discuss the statement that returns data,For example INSERT and the statement that do not return data,For example UPDATE and DELETE.Next,They will write the simple program that retrieves data from the database.

Executive SQL statement

Now,We had had a link,How to and know process an error,It is moment discussion uses our database to come a few real works.Of the SQL that carries out all types advocate key word is Mysql_query:

...
« 首页...« 1 2 3 4 5 6 7 8 9 »...尾页 »