Given article is not a management on administration of a MySQL-server.
Here are presented the most necessary data for beginner users. Therefore
let's consider a server for Windows. The majority of commands are fair and
for unix-systems. In work the console is used basically. The commands entered in
consoles, it is possible to transfer easily to the web-interface (in PHP for this purpose exist special
functions).
For what the database is necessary? Relational databases represent simply a little
tables with records. DB are intended for management of these tables. They allow
to create new tables, to delete unnecessary tables, to do inserts of new records,
to change records and to process inquiries. Actually, in fact and databases are necessary for
gives out the information in the certain order. DB exists great set. The most widespread DB on the
Internet is MySQL which because of the speed and convenience in use has received a wide circulation.
Most important that MySQL is freeware.
MySQL basic advantages:
- The multithreading. Support of several simultaneous inquiries.
- Optimization of communications with connection of many data for one pass.
- Records of the fixed and variable length.
- ODBC the driver complete with a source code
- Flexible system of privileges and passwords.
- Up to 16 keys in the table. Each key can have up to 15 fields.
- Support of key fields and special fields in operator CREATE.
- Support of numbers long from 1 up to 4 bytes (ints, float, double, fixed), lines of variable length and labels of time.
- The Interface with languages C and perl.
- Based on streams, fast system of memory.
- The Utility of check and repair of the table (isamchk).
- All data are stored in format ISO8859_1.
- All operations of work with lines do not pay attention to the register of symbols in processable lines.
- Pseudonyms used both to tables, and to separate columns in the table.
- All fields matter by default. INSERT it is possible to use on any subset of fields.
- Ease of management of the table, including addition and removal of keys and fields.
To begin work it is required to us: a computer, actually MySQL and a label of the console
(it always should be near: though convenience of work under cmd and considerably concedes to work
in console Linux, but a lot of prophetic it is possible to make of the console more quickly, than to climb through 3-5
items of the menu behind the necessary option). A lot of prophetic it will be done through the console. If you will know
the basic commands to use MySQL in web-appendices begins very simply.
Installation MySQL
We shall establish and use a MySQL-server 3.23.38. Installation does not demand greater efforts.
We press some times button Next - and it is enjoyed by work with the program.
Data in MySQL. How are stored?
By default each database is stored in a separate folder which name coincides
with the name of this database. These folders are stored in folder DATA of a directory in which it is established
MySQL server. It is possible to change a site of data by default. For example, you want
to create a database which will be stored in E:/data/database_name. Then you create a file database_name.sym in
directories DATA also write down in it only one line which contains a way to site of your database:
"E:/data/database_name", also keep. If to glance in folders in which data you will see there 3 files are stored.
Data are stored in the "optimized" kind, not in the form of the text. So simply to see them it will not be possible.
So, three files: with expansions .frm - in it the information on tables is stored,
containing in a DB, .myd - actually given and .myi - index data. Now we shall borrow
safety. Data about users MySQL stores in a special database, which
refers to mysql. In it of 5 tables in which logins and passwords are stored in a ciphered kind,
and also attributes of access to the table:
- In tables columns_priv, tables_priv are stored privileges users for access, accordingly, to columns and tables.
- In the table "db" - privileges for access to databases.
- In the table "host" - the information on computers from which are connected users to MySQL.
- The information on users is stored In the table "user".
In the beginning of work it is necessary to replace user with a login root, and also to make user, from under
Which we shall work with a server. Such user should be only îne. Other users should be with the limited rights. Business
in that, that by default the superuser has no password! If you, for example, will bring in the
database the classified information look, remove, change them can
anyone.
We have established the MySQL - begin administration. We find a directory, in
Which we have established our server (by default it C: \mysql). We find directory C: \mysqlbin
Also we see many ".exe" files. For the beginning it is required to us mysqlexe. We start. Options
Start from the console it is possible to look, having written C: \mysqlbinmysql.exe-h, after
That the information will be deduced. All sql-commands are entered in a command line and should come to the end
";" or "g."
About work with databases by means of MySQL read in following clauses of section.
|