How to establish replikaciju


Will make sure, that you have established on both servers I skin the version mysql. Version 3.23.29 is necessary or is higher. The previous versions will correctly not work. Create the special user replikacii on the preferred server with privilege FILE and the sanction of a connection from all reserve servers. If the user only does{makes} replikaciju - do not give him any additional privileges. For example, the user repl (from any servers) GRANT FILE ON *.* TO repl "%" IDENTIFIED BY ";


Stop preferred server MySQL. mysqladmin-u root-p shutdown


Make a copy of all database of your server For example, on UNIX tar-cvf/tmp/mysql-snapshot.tar/path/to/data-dir Unpack on reserve servers (in corresponding catalogues)


On the preferred server in a file my.cnf, establish parameters



[mysqld]

log-bin

server-id=1


server-id - should distinct from server_id reserve servers, it is possible - to use something similar to the IP-address without points.


Restart mysql on the preferred server.


On reserve servers in a file my.cnf, establish parameters



master-host =

master-user =

master-password =

master-port =

server-id =


Establish necessary values and restart reserve the server (server_id - should be unique)


If you have forgotten to establish server_id for the reserve server, in broad gullies there will be a mistake: Warning: one should set server_id to a non-0 value if master_host is set. The server will not act as a slave. If you do not establish on the basic, reserve the server cannot incorporate to the basic. Check up a broad gully of mistakes on reserve servers, at occurrence of problems.


After successful connection the file master.info in the same catalogue as a broad gully of mistakes is created. Do not touch this service file - he is used to trace processing full magazine of changes of the data (Binary Update Log) from the preferred server. For that that something to change use CHANGE MASTER TO command


Notes: Version 3.23.42-1, at use replikacii the certain database above mentioned grant command does not work, it is necessary to correct manually File_priv column in the table user.


Creation and removal{distance} of tables in MS SQL Server

Creation and removal{distance} of tables in ms sql server


All data in a DB sql server are stored{kept} in tables.

Tables will consist of the columns uniting values of one type, and lines - recordings in the table. In one DB can be up to 2 billion tables, in the table - 1024 columns, in one line (recording) - 8060 bajtov.


sql server supports the following types of the data:


Type of the data the Designation the Size, byte

The binary data binary

varbinary [(n)] 1-8000

Symbols char [(n)]

varchar [(n)] 1-8000

(up to 8000 symbols)

Symbols unicode nchar [(n)]

nvarchar [(n)] 1-8000

(up to 4000 symbols)

Date and time datetime 8

smalldatetime 4

Exact numbers decimal [(p [, s])]

numeric [(p [, s])] 5-17

Approximate numbers float [(n)] real 4-84

The global identifier uniqueidentifier 16

Integers int smallint, tinyint 42, 1

Denezhki money, smallmoney 8, 4

Special bit, cursor,

sysname, timestamp 1, 0-8

The text and the image text, image 0-2 Gb

The text unicode ntext 0-2 Gb


Tables can be created with the help of the operator create table language transact-sql, and also with the help enterprise manager. We shall consider all over again as it is done{made} with the help transact-sql.


Sodanie tables with the help create table

The operator is applied to creation of tables create table.

Here is how the simplified syntax of this operator looks:


create table table_name

(column_name data_type [null | not null]

[... n])

For example:



create table member

(member_no int not null,

lastname char (50) not null,

firstname char (50) not null,

photo image null

)


This operator creates the table member, consisting of four columns:


member_no - has type int, values null are not supposed

lastname - has type char (50) - 50 symbols, values null are not supposed

firstname - it is similar lastname

photo - has type image (image), value null is supposed

The note

null - a special designation of that the element of the data has no value. In the description such as a column it is underlined, that elements of the data can be neinicializirovany. At the instruction{indication} not null - "empty" values are not supposed. If at an insert of recording to pass{miss} value for such column, the insert will not take place, and sql server will generate a mistake.


Try to execute this command. Start query analyzer. Incorporate to your server. From the list of a DB choose sqlstep. Copy in a window of commands the command of creation of the table and execute her{it}. (If not have forgotten, it is necessary to press f5 or ctrl-e).


Precisely to make sure, that the table has been created, type{collect} the command:


sp_help member

Allocate her{it} (as in the usual editor) and again press f5. In a window of results the information on the table member will be deduced{removed}.


On a note!


sp_help - system procedure which returns the information on objects of a DB (the tables, stored{kept} procedures and so forth).

The format of a call is those:


sp_help <a name of the table>


To remove the table as easy as shelling pears. In the same place, in a requester (so at us name query analyzer), type{collect}: