Working with MySQL Databases through Consoles/Commandline
Author Brian Menadue
Date 06/17/09
Working with MySQL Databases through Consoles
This tutorial will guide you through the creation and testing stages of working with a MySQL Database via Console. Actual commands are preceded by "mysql> ". Actions that do not include entering commands are indicated thus: <<<(Action to be taken.)>>>. Commands are not case sensitive but are shown in CAPS for instruction purposes.
<<<(Open Secure Shell Client Console or Command Prompt. Enter the proper login information to connect to server.)>>>
Login to MySQL
MYSQL -u root -p
<<<(Enter password when prompted or just press enter if root has no password.)>>>
Create Database
mysql> CREATE DATABASE databasenameDB;
Create User for Database
mysql> CREATE USER username@localhost IDENTIFIED BY 'password';
Grant Privileges to User for Database
mysql> GRANT ALL PRIVILEGES ON databasenameDB.* TO username@localhost IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
Make sure CORRECT Database is in use
mysql> use databasenameDB;
Create Table in Database
mysql> CREATE TABLE tablenameTB (fieldname VARCHAR(20));
Verify Table Exists
mysql> show tables;
Verify Columns in Table
mysql> show columns from tablenameTB;
<<<(Test your web interface to your database here.)>>>
Verify First Entry to Database Table
mysql> select * from tablenameTB;
Working with Tables in HTML
Author Brian Menadue
Date 06/26/09
Working with Tables in HTML.
This tutorial will guide you through the creation of working with Tables in HTML. Actual tags will be within "chicken lips" <...>. Actions that do not include entering tags are indicated thus: <<<(Action to be taken.)>>>. Tags should be typed in lowercase to be xhtml compliant.
<<<(Open a text editor such as notepad, wordpad, or textpad.)>>>
The second thing to do is put in the following tags and text.
Title of Your Page
This is where the content of your page will go. Including the table.
Now replace "This is where the content of your page will go. Including the table." with the following:
This is a Table.
The above code won't do you much good as a table unless you give the table rows and columns. Rows are what you call the horizantal divisions within a table. Columns are what you call the vertical divisions within a table.
Rows are created with the tr tags.
Columns are created by putting a number of td tags within each row.
We are now going to create a single row with one column in our table. Input the following tags between the table tags.
This is a single column, single row table.
The above code will give us the table below.
This is a single column, single row table. |
The table above only has one cell. That's not much use for most websites, so we'll modify our table to have three cells in a single row. We can do that by copying the code below and pasting it twice more between the /td and tr tags.
This is a single column, single row table.
The code should look like the following.
This is a triple column, single row table.
This is a triple column, single row table.
This is a triple column, single row table.
The above code will give us the table below.
This is a triple column, single row table. | This is a triple column, single row table. | This is a triple column, single row table. |
The table above only has one row. Now we'll modify our table to have three cells in each row and three rows. We can do that by copying the code below and pasting it twice more between the /tr and /table tags.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
The code should look like the following.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
The above code will give us the table below.
This is a triple column, three row table. | This is a triple column, three row table. | This is a triple column, three row table. |
This is a triple column, three row table. | This is a triple column, three row table. | This is a triple column, three row table. |
This is a triple column, three row table. | This is a triple column, three row table. | This is a triple column, three row table. |
I'll now demonstrate how to span a cell across columns. You do this with the "colspan" attribute, which is added to the "td" tag.
This method can be used to create a simple heading for tables.
We will be replacing the three cells in the first row with the code above. The modified code shold look like the below.
This method can be used to create a simple heading for tables.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
The code above will give you the following table.
This method can be used to create a simple heading for tables. | ||
This is a triple column, three row table. | This is a triple column, three row table. | This is a triple column, three row table. |
This is a triple column, three row table. | This is a triple column, three row table. | This is a triple column, three row table. |
I'll now demonstrate how to span a cell across rows. You do this with the "rowspan" attribute, which is added to the "td" tag.
This is an example of a rowspan.
We will be replacing the first cell in the first row with the code above and deleting one cell from each of the other two rows. The modified code shold look like the below.
This is an example of a rowspan.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
This is a triple column, three row table.
The code above will give you the following table.
This is an example of a rowspan. | This is a triple column, three row table. | This is a triple column, three row table. |
This is a triple column, three row table. | This is a triple column, three row table. | |
This is a triple column, three row table. | This is a triple column, three row table. |
There are many more things you can do with tables but you can learn about those on your own from www.w3schools.com.