1./etc/init.d/mysql restart 2.mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); mysql>\q; quit mysql mysql>create database databasename; mysql>drop datebase databasename;||drop schema databasename; This means to delete the existed database. mysql>show databases; mysql>use datebase; mysql>show tables; mysql>create table tablename(); For example: mysql> CREATE TABLE grocery_inventory ( -> id int not null primary key auto_increment, -> item_name varchar (50) not null, -> item_desc text, -> item_price float not null, -> curr_qty int not null -> ); For example: mysql>use mysql; mysql>select * from person; mysql> insert into person (id,firstname,lastname) values(106,'peter','wang');
Note:don't forget a semicolon(;) at the end of the statements.
There is a good web address'http://www.webdevelopersnotes.com/tutorials/sql/index.php3'