It is not so important, because of which you are interested in the question of how to create a mysql database , it is much more important if you have a basic set of knowledge, without which there is no need to talk about the successful implementation of the plan.
In this article I will tell you what actions any PC owner should take if he needed to install mysql for some purpose, create a database, and try his hand at managing a modern database. It will also be interesting to those who want to know how to make a modern DBMS work.
Since, as I said, in order for everything to work out, you need basic knowledge, without which it will not work to create a mysql database, so we will assume that you know what a database, table, and queries do not put in the database dead end SQL abbreviation. We will also assume that you have installed and configured the Apache server.
So, if you have everything you need, and the desire to learn how to create a mysql database has not disappeared, then let's start by starting Apache. To start it, go along the path C: \ WebServers \ etc and run the Run file. If Apache started correctly, without errors, then in the lower right corner a red pen will be added to the existing icons.
Now you need to make sure that the web server is working, enter the address http: // localhost / in the browser in response, you should get the text “Hurray, it worked!”, If you see it on the monitor, then Apache is in full order.
Now we go into the Utilities and select phpMyAdmin from the list, you have a graphical shell that allows you to manage the mySQL DBMS. With its help, you can perform all the operations without exception that are provided by the creators of this database, and specifically:
Database creation
In order to create a database, in the "Create a new database" field, you must enter a name, for example, MyBase. Now click the “Create” button, and phpMyAdmin will create a new database.
Create tables
Creating tables is quite simple, you should choose a database (MyBase). In the main window they will offer to enter a name for the table (try to enter the name DataStudent), and you will also need to enter the number of fields (put the number 5). Choosing how many fields you will have, do not forget that one field goes under the key (ID). If you entered everything correctly - then press the "Enter" button.
Now you will see an additional form for creating tables. In it you can set fields, assign data types for each of them, name columns, determine their maximum sizes. Typically, the first field is key. We enter the name “ID” in it, now we need to determine the type of data that will be entered for this column. Since there is no such type as a counter in MySQL, you should select Int, check the unsigned checkbox in the attributes. Then we go into the advanced settings and set Auto-increment there, so that each time you enter a new value, this field independently increases its value by one.
Thus, you get a typical counter. It's time to move on to the next group of settings - RadioButton. Here we select the value “primary”, if it is activated, then our field becomes the primary key.
If you did everything correctly, then the main field is configured correctly; when you add lines to it, the ID value automatically increases. And you are one step closer to understanding how to create a MySQL database.
Moving on, now we need to determine the values ​​and give the names to the other columns of our table. Let it be information fields. Surname, first name, and, for example, an assessment: “Fam”, “Name”, “Otch”, “Ocenka”, it remains to assign the data type - varChar, because in these fields information will be stored as a string. Do not forget to set the maximum length of the fields, it would be logical to limit it to a value of 30 characters. Check all the entered data and admire the table you created. It should have a set of fields with the names "ID", "Fam", "Name", "Otch", "Ocenka".
I hope that the information provided in this article was useful to you, and you found the answer to the question about how to create a MySQL database.