Working with mysql-(2)

woodhzud

New Member
Drop or delete a table in MySQL


To delete a table, run



PHP Code: \[code\] drop table table_name; 
\[/code\]


This need to be done while you use the database or run following command.



PHP Code: \[code\] drop table db_name.table_name; 
\[/code\]


Only delete table if it is exists.



PHP Code: \[code\] drop table if exists db_name.table_name; 
\[/code\]



Repair MyISAM table


To find list of corrupted tables



PHP Code: \[code\] myisamchk /var/lib/mysql/DB_NAME/*.MYI >> /root/1.txt 
\[/code\]

To rapier a table
PHP Code: \[code\]      cd  /var/lib/mysql/DB_NAME/ 
myisamchk -r TABLE_NAME_HERE.MYI 
\[/code\]
To check and repair all tables


PHP Code: \[code\]myisamchk --silent --force --fast --update-state /var/lib/mysql/DB_NAME/*.MYI 
\[/code\]
 
Top