Kamis, 02 Juli 2020

How to Use MySQL

Databases have been the backbone of many successful sites. Google, Facebook, Wikipedia, WordPress sites and many business sites use MySQL to create databases and use the data on their web sites.

Who Invented MySQL?

Ulf Michael Widenius, from Finland was the developer of MySQL and named the program after his daughter, My. It was released for the first time in 1996. Sun Microsystems purchased it on February 26, 2008, making Ulf Michael Widenius, one of the top ten money earners in Finland. You'll see a table that looks like an empty spread sheet. In the field column, you want to name all of the columns a single word or if you use two words, you need to join them with an underscore. Fill in all of the fields you can.

How To Create A Database

To understand how to use these tools to make your website better, you'll need to know how to create an Excel spreadsheet file. Since Excel is so widely used, you are probably familiar with using it. You can easily see that information is basically stored in columns and rows.

Imagine that you had a physical store that sold colored balls in a variety of colors and sizes made in a variety of materials and sold at different prices. You could create a spreadsheet that contained all of this information. Each product would be put in one row. Each attribute would be listed in columns on that row. This format is what you need to create a MySQL database.

The next step is to import your file into the MySQL database? You will need to save this Excel file as a comma separated value file.

Log in to your web hosting account. Find the Database Wizard to create a database. When you create this database you'll be given a username and password to get into it. Keep a copy of that somewhere you'll remember it. You will need it later. Now you want to find the phpMyAdmin button and open that link. The screen you see will show you the database name that you just created. Click on the name of the database.

How To Create A Table

You have to create a table to hold the information you are about to import into it. The table you create will have column headings for each of the attributes you created in your spread sheet. You can have any number of columns you desire. Find the word operations and open that link. Create the table by giving it a name and stating how many columns you want in your table. It will have to match the number of columns in your spreadsheet. Click go to create the table.

Choose a type for each column. Generally you'll need to start with VARCHAR which allows the text to be a variety of characters. Then you'll need to decide how big the field will be. Some fields will just be two characters and others may be up to 255. If you need more space than that to store your data, you'll have to choose LONGTEXT. There are specific paramaters that the other columns need, but you don't have to fill them all in. You will have to decide whether you need to have an empty field (null) or have it filled (not null).

Determine which field you want as your primary field and select that option. Usually one field needs to be primary so you may want to make that your productID which is usually unique as well. Click go and the table gets created for you. You'll see that you can browse your table but nothing will be in it yet.

How To Import Data Into A Table

Choose the import function in the horizontal row above the table. Use the browse button to browse your computer for the csv file that you created. Then you check the option CSV using LOAD DATA. You will need to change the fields terminated by a semicolon to fields terminated by a comma. That means just erase the semi colon and put a comma in place of it. Click go and your data gets imported into the new table. View your data through the browse button.

Now you have a database that has data in it. You can create as many tables as you would like to and you can also import more data by following the above steps. The information in the database is stored through your hosting company. The next thing you will want to learn is how to use the data you just put into your database. You'll want to display the data on your website.

Tidak ada komentar:

Posting Komentar