1 頁 (共 1 頁)

常用語法

發表於 : 2005-08-04 15:59:00
schumi
select student_no,name,sex,sn,addr from student where sex = '0' limit 0,22;

說明: 列出 student 資料表中包含 student_no,name,sex,sn,addr 資料,並且限定sex代號為0的資料, 然後限定資料筆數從第0到第22筆


select sex,count(*) from student group by sex;

說明: 列出 student 資料表中有關性別資料
count(*) 是說"列出筆數"
group by sex 是說"資料中的性別組群"

建立新的資料庫

發表於 : 2005-11-07 11:21:53
schumi
create database phpbb2;

grant all privileges on phpbb2.* to phpbbuser@localhost identified by 'your.password' ;

utf-8

發表於 : 2005-12-08 14:03:30
schumi
CREATE DATABASE redmine CHARACTER SET utf8 COLLATE utf8_general_ci;

發表於 : 2006-12-07 14:48:57
schumi
重新載入MySQL 權限設定

mysqladmin flush-privileges

查看MySQL 負載情況

發表於 : 2008-07-21 17:09:00
schumi
# mysqladmin processlist -u root -h db2

或是

# mysqladmin processlist -u root -h db2 | grep Query

Re: 常用語法

發表於 : 2010-08-26 09:42:51
schumi
檢查並修復 crash 掉的table

mysqlcheck --auto-repair -A -u root -p

建立user

發表於 : 2012-01-18 15:48:38
schumi
CREATE USER 'aaa'@'192.168.10.122' IDENTIFIED BY '***';

GRANT ALL PRIVILEGES ON * . * TO 'aaa'@'192.168.10.122' IDENTIFIED BY '***' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;