Tuesday, June 15, 2010

Database related

Good mysql tutorial.

http://www.webdevelopersnotes.com/tutorials/sql/mysql_training_course_creating_tables.php3


Create database on the linux system:

================
mysql -u root -p
create database employees;
GRANT ALL ON employees.* TO setup@localhost;
================

First line login as root.
Second line create an database.
Third line give the user "setup" all the privilege.

===============
show databases;
use employees;
show tables;
CREATE TABLE `members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL default '',
`password` varchar(65) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
INSERT INTO `members` VALUES (1, 'john', '1234');
describe members;
select * from members;
===============

0 line shows the database you can operate.
First line select a database to operate.
Second line create a table.
Third line insert one data into the tabel.
4th and 5th line check the table and database.



\

No comments:

Post a Comment