Controlling the database
Do you still remember the password for the database?
Before you forget it, we'll control if the database is
OK. (Well, it's a critical step, if it doesn't work,
you'll have to pay a new guiness to your
administrator)
$ mysql dabase -udaiouser -pdapass
mysql> create table matable (madate date);
Query OK, 0 rows affected (0.00 sec)
mysql> insert into matable values (now());
Query OK, 1 row affected (0.00 sec)
mysql> show tables;
+------------------+
| Tables in dabase |
+------------------+
| matable |
+------------------+
1 row in set (0.00 sec)
mysql> describe matable;
+--------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+------+------+-----+---------+-------+
| madate | date | YES | | NULL | |
+--------+------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> select * from matable;
+------------+
| madate |
+------------+
| 2001-01-04 |
+------------+
1 row in set (0.00 sec)
### Looks like it works, cleaning up
mysql> drop table matable;
Query OK, 0 rows affected (0.00 sec)
mysql> show tables;
Empty set (0.00 sec)
mysql> exit
Bye
|
$ psql dabase -U daiouser
type your password "dapasse"
Welcome to psql, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
dabase=> create table matable (madate date);
CREATE
dabase=> insert into matable values (now());
INSERT 17886 1
dacode=> \dt
List of relations
Name | Type | Owner
----------------------+-------+--------
matable | table | daiouser
(1 row)
dabase=> \d matable
Table "matable"
Column | Type | Modifiers
---------+------+-----------
matable | date |
dabase=> select * from matable;
matable
------------
2002-07-21
(1 row)
### Looks like it works, cleaning up
dabase=> drop table matable;
DROP
dabase=> \dt
No relations found.
dabase=> \q
|
Creating
the tables
Stil remember the password? Great!
Modify daCode/sql/dacode.mysql or
daCode/sql/dacode.pgsql at the line:
INSERT INTO users (id,login,passwd,level,email) VALUES ('2', 'admin','X','6291456','root');
|
and replace root with your email adress.
Then create your tables with the SQL script
(dacode.mysql or dacode.pgsql).
$ mysql dabase -vvv -udaiouser -pdapass < daCode/sql/dacode.mysql
or
$ psql dabase -U daiouser < daCode/sql/dacode.pgsql
|
daCode may come with a file dump.sql wich would hold some
exemples. The install will be the same.