How to insert data into MySQL table

Here is a general form of insert command:

insert into table (column1, column2) values (value1, value2);

The insert statement inserts new row into an existing table. The table is the name of the table into which we want to insert data, column1 and column2 are column names and value1, value2 are values for the respective columns.

Example:
We want to create an account name "user" with password "password" in our freeradius database.
First thing we need to do is to login to MySQL database server and select the radius database.

use radius;

Lets see the structure of the radcheck table by typing this command:

describe radcheck;

or

desc radcheck;
+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra          |
+-----------+------------------+------+-----+---------+----------------+
| id        | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
| username  | varchar(64)      | NO   | MUL |         |                |
| attribute | varchar(64)      | NO   |     |         |                |
| op        | char(2)          | NO   |     | ==      |                |
| value     | varchar(253)     | NO   |     |         |                |
+-----------+------------------+------+-----+---------+----------------+
5 rows in set (0.09 sec)

Basically what we want to do is to insert data into the "id", "username", "attribute", "op", and "value" field.
Type this command to insert data into it.

insert into radcheck (id, username, attribute, op, value) values (1, 'user', 'Cleartext-Password', ':=', 'password');

Now type this command to check.

select * from radcheck;

You should see like this on your screen.

+----+----------+--------------------+----+----------+
| id | username | attribute          | op | value    |
+----+----------+--------------------+----+----------+
|  1 | user     | Cleartext-Password | := | password |
+----+----------+--------------------+----+----------+
1 row in set (0.00 sec)