How to create a mysql database

click fraud protection

not so important, which is why you are interested in the question of how to create a database mysql, more importantly, whether you have a basic set of knowledge, without which talk about the successful implementation of the planned no.

In this article will talk about what steps need to be taken to any PC owner, if he for some goals need to install mysql, create a database, and try their hand in the management of modern databases.Also it will be interesting to those who want to know how to make it work the modern DBMS.

Because, as I said, in order to have everything worked out, basic knowledge, without which create a mysql database does not work, respectively, we will assume that you know what database tables, queries to the database andYou are not baffled by the acronym SQL.Also, we assume that you have installed and configured the server Apache.

So, if you have everything you need in there, and the desire to learn how to create database mysql, has not yet gone, then start with that run Apache.To start it will go on the path C: \ WebServers \ etc and run Run.If Apache correctly without errors start, then in the lower right corner of the icon Add to the existing red pen.

Now you need to make sure that web server running in a browser, enter the address http: // localhost / In response, you should get text "Hurrah, earned!", If it is you see on the monitor, then to Apache in order.

Now go in and Utilities in the list, select phpMyAdmin, you have a graphical shell that allows you to manage database mySQL.With it you can perform all the operations, without exception, are provided by the creators of the database, specifically:

Creating Databases

In order to establish a base in the "Create new database" you must enter the name, for example, MyBase.Now press the button "Create" and phpMyAdmin will create a new database.

Creating tables Creating tables is quite simple, you need to choose a base (MyBase).In the main window prompted to enter a name for the table (try to write the name DataStudent), as well as the need to enter the number of fields (put figure 5).When choosing how much you will have fields, do not forget that one field out turnkey (ID).If you entered correctly - then press «Enter».

now in front of you will open an additional form to create tables.In it you can select a field, assign data types to each of them, called the column, to determine their maximum sizes.As a rule, the first field is the key.Fits in it the name of «ID», now we have to determine the type of data to be entered for this column.Since this type in MySQL, the counter does not exist, choose Int, put a checkmark in the attributes unsigned.Then go to advanced settings and set there Auto-increment, so that each time you enter a new value, this field independently increases its value by one.

Thus, you will have a typical counter.It's time to move on to the next group of settings - RadioButton.Here, select "primary" if it is enabled - that our field is the primary key.

If you've done everything correctly, the main field you set up correctly, with the addition of strings in it automatically increases the value of ID.And you are even a step closer to understanding how to create a database MySQL.

Moving on, now we need to define the values ​​and give the names of the rest of the columns of our table.Let it be in the fields.Last name, first name and, for example, estimate: «Fam», «Name», «Otch», «Ocenka», left to select the type of data - varChar, because in these fields will store the information in a string.Do not forget to set the maximum length and the fields would be logical to limit it to a value of 30 characters.Check out all the entries and feast your eyes on the table you created.It should be a set of fields with the names «ID», «Fam», «Name», «Otch», «Ocenka».

I hope that the above information in this article is useful to you, and you will find the answer to her question about how to create a database MySQL.