|
I hope this tutorial helps in answering questions beginners may have about PhpMyAdmin. For those of you that don't know what PhpMyAdmin is, its a very popular database editing program written in PHP to handle mySQL databases. Almost all virtual servers that support mySQL use it. Best of all, its freeware. How to set Up a Table inside a Database After you've set up and created the database, you need to log-in with the name and password to PhpMyAdmin. The interface is basically split into two sections, the left frame and the right frame. You should see the name of the database you created on the left frame. For our purposes, the name of the database can be "db_data". Go ahead and click "dbdata". Two things should happen: the "+" should change to a "-" and, on the right frame, a new screen should come up saying "Database db_data". Go down till you see "Create new table on database "db_data." Under name, put "table_data" and under Fields, put the number of fields you want, for our purposes 2, for ID and Message. Click Go. For those people that are new to mySQL, "ID" is the usual name given to recognize each table row. Each row has a unique ID Number by which we can track it. We want "Message" to be a long message so we want to store a lot of data on that.
Inside the next screen on the right, you should see 2 rows of forms with sections like Field, Type, Length, etc. Under the first row, we want to label the Field "ID". We want to set the Type as an Int so choose that from the drop down. Leave all the rest of the sections in that row blank except for extra, which we want to Auto Increment because its a unique number for each row. We also want it to be the Primary so check that.
The next row enter "Message" as the field and Type as Long Text. Leave all the rest of the fields blank. Click save and there you have your first table :)
What is a Dump and How do I do it?
A dump in mySQL is basically the database written out in a text format so that its handy to transfer around. For example, say you have a database on one server and since you're switching servers you need to switch the database over also. With phpMyAdmin, you just click on the database on the left frame, and select "Structure and Data" from the "View dump (schema) of database" part on the right frame, click Go and copy it into a text file and save it. Then go to the new server and after making the new database, select "Run SQL query/queries on database", click Browse and select the text file and boom, your database is on the new site, great isn't it :)
Types
Here is a description of all the types you can have for String Types as taken from the mySQL
Manual:
1. Char - Maximum 255 bytes 2. Varchar - Maximum 255 characters in a string 3. Tiny Blob, Tiny Text - Maximum 200,000,000 byes 4. Bob, Text - Maximum 20,000,000,000,000,000 byes 5. Medium Blob, Medium Text - Maximum 2 x 10^24 byes 6. Long Blob, Long Text - Maximum 2 x 10^32 bytes 7. Enum - Maximum 2 bytes with a Maximum 65,535 values total 8. Set - Maxmimum 8 bytes with a Maximum 64 values total
Here is a description of all the types you can have for numeric types as taken from the
mySQL Manual:
1. Tinyint - 1 byte 2. Smallint - 2 bytes 3. Mediumint - 3 bytes 4. Int - 4 bytes 5. Integer - 4 bytes 6. Bigint - 8 bytes 7. Float(x) - 4 if x<&24 or 8 if 25<=x<= 53 8. Float - 4 bytes 9. Double - 8 bytes 10. Double Precision - 8 bytes 11. Real - 8 bytes 12. Decimal(M,D) - M+2 bytes if D > 0, M+1 bytes if D = 0 (D+2, if M < D) 13. Numeric(M,D) - M+2 bytes if D > 0, M+1 bytes if D = 0 (D+2, if M < D)
And finally the date/time types:
1. Date - 3 bytes 2. DateTime - 8 bytes 3. TimeStamp - 4 bytes 4. Time - 3 bytes 5. Year - 1 bytes
Credit: www.spoono.com
|