Friday, May 4, 2007

Important MySQL commands

Restoring MySQL dump

Option 1 - Having a DB Dump with insert into statements
* Go to the corresponding directory and run following commad
* mysql -u user -ppassword -D dst_temp -h 192.168.0.57 -e "source LAP_BONUS_EVENT";


Option2 - Having backup with comma-separated format
* Copy the file to Mysql data directory (eg: /usr/local/mysql/data/dst_temp)
* Go to the Mysql data directory and loggin to the mysql prompt (mysql -uuser -ppassword) and run the following command
* LOAD DATA INFILE 'filename' INTO TABLE VOICE_CALL_EVENT FIELDS TERMINATED BY ',';



Change the MySQL grant privileges
* GRANT ALL PRIVILEGES ON *.* TO user@"%" IDENTIFIED BY 'password' WITH GRANT OPTION;


Get a MySQL dump
* Go to MySQL home (eg: /usr/local/mysql)
* execute ./bin/mysqldump -u user -ppassword dst_report > dst_report_08_04_2007.txt


To get no of mysql connections acquired
* mysql> show processlist; (in mysql prompt)

No comments: