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 是說"資料中的性別組群"
常用語法
查看MySQL 負載情況
# mysqladmin processlist -u root -h db2
或是
# mysqladmin processlist -u root -h db2 | grep Query
或是
# mysqladmin processlist -u root -h db2 | grep Query
建立user
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 ;
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 ;