To start mysql Server 

#mysqld_safe  &

or

#mysqld &

(To start server with logging option 

#mysqld –l  &

log files are written in data directory as hostname.err  and hostname.log)

To Change root user password 

#mysqladmin -u root password ‘newpass’

#mysqladmin –u root –h “hostname” password ‘newpass’

 ( usually mysql has 2 entries : one for localhost and one for the hostname and 2 anonymous users for those both initially )  

To connect to mysql server 

#mysql –u root –p

Show All database in System

mysql> SHOW DATABASES;

Use particular database

Mysql> use  testdb

Or you can run quries with prefix  :  like   SELECT * FROM testdb.mytable;

DELETE INITIAL ACCOUNTS & SET ROOT PASSWORD 

Mysql> DELETE FROM mysql.user WHERE User = ‘’;

Mysql> FLUSH PRIVILEGES;

Use mysqladmin  to set password as explained above

Create NEW Database 

Mysql> CREATE DATABASE   mydb;

Create New USERS 

Mysql> GRANTE ALL ON mydb.*  TO ‘testuser1’@’localhost’ IDENTIFIED BY ‘testpass1’;

Mysql>FLUSH PRIVELEGES;

 

Shutdown Server 

#mysqladmin shutdown