1.連接數據庫
shell:
Mysql -u$user -p [$database]
Php:
$con = mysql_connect($Host,$DbaUser,$DbaPassword);
2.展示數據庫,選擇數據庫
show databases;
show tables;
describe table;
Shell:
Use mysql
Php:
$db_selected = mysql_select_db($Database,$con);
3.查詢數據
Mysql 子命令:
Select * from table where
Php:
$sql = "select * from showlimits_$Dtime order by R_RATE desc";
$result = mysql_query($sql,$con);
允許某臺主機訪問數據庫
mysql子命令下:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.26.170.14' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
flush privileges;
mysql 數據類型:http://www.cnblogs.com/bukudekong/archive/2011/06/27/2091590.html
select now(); 可獲取當前時間
phpadmin 安裝過程:http://www.51099.com/comp/damy/20101012/353921.html