mysql -uroot -p
1.查看數(shù)據(jù)庫秀睛,選中使用數(shù)據(jù)庫,并查看數(shù)據(jù)庫表莲祸,具體操作命令如下:
show databases;
use student;
show tables;
desc tables;//查看表字段類型
2.選擇student數(shù)據(jù)庫中的一張表stu_score蹂安,查看數(shù)據(jù)庫表數(shù)據(jù),并利用explain分析數(shù)據(jù)庫表锐帜,如下圖所示:
select * from stu_score;
explain select * from stu_score;
3.查看數(shù)據(jù)庫使用索引的情況田盈,使用命令:
show status like 'Handler_read%';
4.用于分析和存儲表的關鍵字,分析的結果可以得到精準的信息抹估,利用命令analyze缠黍,
analyze table stu_score;
5.檢查數(shù)據(jù)庫表stu_score,檢查表是否有錯誤,利用命令:
check table stu_score;
6.優(yōu)化數(shù)據(jù)庫表药蜻,利用命令:
optimize table stu_score;
擴展資料:
可以使用命令行工具管理 MySQL 數(shù)據(jù)庫(命令 mysql 和 mysqladmin)瓷式,也可以從 MySQL 的網(wǎng)站下載圖形管理工具 MySQL Administrator, MySQL Query Browser 和 MySQL Workbench。
phpMyAdmin是由 php 寫成的 MySQ L資料庫系統(tǒng)管理程程序语泽,讓管理者可用 Web 界面管理 MySQL 資料庫贸典。
phpMyBackupPro也是由 PHP 寫成的,可以透過 Web 界面創(chuàng)建和管理數(shù)據(jù)庫踱卵。它可以創(chuàng)建偽 cronjobs廊驼,可以用來自動在某個時間或周期備份 MySQL 數(shù)據(jù)庫。
另外惋砂,還有其他的 GUI 管理工具妒挎,例如 mysql-front 以及 ems mysql manager, navicat等等。