MySQL key commands

mysql> GRANT ALL ON SAMP_DB TO roger@localhost;

mysql>select * from user;

mysql>use databasename

mysql>show databases;

mysql>show tables;

mysql>describe tablename;

mysql>delete from user where user = ‘roger’;

mysql>flush privileges;

mysql>create table president (last_name varchar(15) not null, first_name varchar(15) not null , suffix varchar(5) not null, expiration_date NULL DEFAULT “0000-00-00”, email varchar(100) null);

mysql>alter table president modify city varchar(50);

mysql>alter table member add member_id int unsigned not null auto-increment, primary_key;

mysql>select 2+2, “helloworld”, version(), concat(firstname,” “,lastname) as name, concat(city, “ “, zipcode) as place from member;

$ mysqlshow samp_db president -p

Shows table description from $ prompt

mysql> insert into president (firstname, lastname) values (“George”, “Washington”);

mysql> update president set firstname = “George”, lastname = “Washington”;

mysql> select now(), user(), version();

mysql>load data local infile “member.txt” into table member;

imports data from member.txt into table member.

$ mysqlimport –local trix member.txt