Posts filed under 'Mysql'

Linux mysqladmin complete commands with clear definition

mysqladmin
==========

mysqladmin -u root password <pwd>           <—-to set a passwd for root user

mysqladmin -u root -p<pwd> password ‘newpwd’   <—-to change the MySQL root user password

mysqladmin -u root -p<pwd> ping               <—-to check whether MySQL Server is up
mysqladmin ping                       <—-if no password for mysql

mysqladmin version                     <—-to find out version of mysql

mysqladmin status                   <—-to view current status of MySQL

mysqladmin extended-status             <—-to view all Mysql status variable & its value

mysqladmin variables                   <—-to view MySQL system variables & its values

mysqladmin processlist                 <—-to view all running mysql process/queries
mysqladmin processlist             <—-to update the cmd every 2 second

mysqladmin kill <PID>                  <—-to kill hanging MySQL Client Process by its ID

mysqladmin create <dbname>             <—-to create a MySQL Database

mysqladmin drop  <dbname>              <—-to delete an existing MySQL database

mysqladmin shutdown                   <—-to shutdown the MySQL server

mysqladmin pro stat ver               <—-short form of processlist, status & version cmd

mysqladmin flush-hosts                 <—-Flush all information in the host cache
mysqladmin flush-logs
mysqladmin flush-privileges            <—-Reload the grant tables
mysqladmin flush-status                   <—-Clear status variables
mysqladmin flush-tables
mysqladmin flush-threads               <—-Flush the thread cache

mysqladmin -h <IP> -u root -p<pwd> stat <–to view status of remote server, if privileges given

Add comment April 4, 2009

When MySQL Tables is corrupted use myisamchk to Recover

1. Identify all corrupted tables using myisamchk
=============================


# myisamchk /var/lib/mysql/bugs/*.MYI >> /opt/myisamchk_log.txt

myisamchk: error: Wrong bytesec: 0-0-0 at linkstart: 18361936
MyISAM-table ‘attach_data.MYI’ is corrupted
Fix it using switch “-r” or “-o”
myisamchk: warning: 1 client is using or hasn’t closed the table properly
MyISAM-table ‘groups.MYI’ is usable but should be fixed

the output of myisamchk to a temporary file, display only the corrupted table names.


2. Repair the corrupted table using myisamchk
=============================

# myisamchk -r profiles.MYI

- recovering (with sort) MyISAM-table ‘profiles.MYI’
Data records: 80
- Fixing index 1
- Fixing index 2


3. Perform check and repair together for entire MySQL database
=========================================

# myisamchk –silent –force –fast –update-state /var/lib/mysql/bugs/*.MYI

myisamchk: MyISAM file /var/lib/mysql/bugs/groups.MYI
myisamchk: warning: 1 client is using or hasn’t closed the table properly
myisamchk: MyISAM file /var/lib/mysql/bugs/profiles.MYI
myisamchk: warning: 1 client is using or hasn’t closed the table properly


5. Use myisamchk to get information about a table
===============================

# myisamchk -dvv profiles.MYI

MyISAM file: profiles.MYI
Record format: Packed
Character set: latin1_swedish_ci (8)
File-version: 1


(more…)

Add comment February 17, 2009

Previous Posts


Categories

current online

Feeds

Blogroll

Archives

Category Cloud

400 MB Movie List Bollywood Movies E-Books Earn money Funny Videos Games Cheat Code General Health Hollywood Movies IPL Linux Linux cmds Mail Server Mobile Mobile Secret Codes Movie Download Movie Photos MP3 Download Music Mysql Nagios News Nrpe Online Movies PC Games PS2 Games Sports Trailer Video Songs WWE

Email Subscription

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

sa

Sign up for our free email newsletter

Enter your email address:

Delivered by FeedBurner