#mysqladmin -u
eg:-#mysqladmin -u root password 123
#mysqladmin -u
eg:-#mysqladmin -u root -p123 password 321
#mysql -u
eg:-#mysql -u root -p321
mysql>create database
eg:-mysql>create database salesdata;
mysql>show databases;
eg:-
+--------------------+
| Database |
+--------------------+
| information_schema |
| detail |
| mysql |
| salesdata |
| test |
+--------------------+
mysql>grant all privileges on
eg:-mysql>grant all privileges on salesdata.* to raj@'localhost' identified by '1';<== grant command create new user also*
#mysql -u
eg:-#mysql -u raj -p salesdata
mysql>show databases; <== to list the tables in that particular database
eg:-
+-----------+
| Database |
+-----------+
| salesdata |
+-----------+
mysql>use
eg:-mysql>use salesdata;
mysql>show tables; <== to list the databases
eg:-
+---------------------+
| Tables_in_salesdata |
+---------------------+ <== It shows the tables in the salesdata database tables
| test |
+---------------------+
1 row in set (0.00 sec)
mysql> describe ; <== It describes the fields in test table
eg:-
+---------------+--------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+------------+----------------+
| num | int(11) | | PRI | NULL | auto_increment |
| date_modified | date | | MUL | 0000-00-00 | |
| name | varchar(50) | | MUL | | |
| description | varchar(75) | YES | | NULL | |
+---------------+--------------+------+-----+------------+----------------+
#mysqldump --database -u
eg:-mysqldump --database -u raj -p1 salesdata > salesdata.sql
#mysql -u raj -p1
mysql> drop database
eg:-mysql> drop database salesdata;
#mysql -u raj -p1
mysql> create database
in other machine or etc..
# mysql --database -u -p
eg:- mysql -u raj -p123 --database salesdata < salesdata.sql <== all the tables in the backup database will extracted
in this databse.
#mysql -u root -p123
#flush privileges; <== to change the privileges