MySQL Syntax |
CREATE DATABASE [ IF NOT EXISTS ] db_name; |
SHOW GRANTS FOR 'user'; |
REVOKE grant_name ON db_name.* FROM 'user'; |
GRANT ALL ON db_name.* TO 'user'; |
CREATE [ TEMPORARY ] TABLE [ IF NOT EXISTS ] tbl_name
( field_names data_type [ DEFAULT default_value ],
CONSTRAINTs ); |
DROP TABLE IF EXISTS tbl_name; |
INSERT INTO tbl_name VALUES
( all field values ),( all field values ); |
INSERT INTO tbl_name
load data from existing db with
select statement |
INSERT INTO tbl_name( field_values ) VALUES
( some field values ),( some field values );
unassigned fields take default
values |
INSERT INTO tbl_name (field_values)
load specific fields from existing
db |
DELETE FROM tbl_name
WHERE where_condition;
section 12.2.2 DELETE Syntax |
TEE file_name; |
SOURCE file_name; |
USE db_name; |
SHOW TABLES; |
DESCRIBE tbl_name; |
SHOW DATABASES; |
ORDER BY field; |
SELECT fields FROM tbl_name WHERE conditions; |
UPDATE tbl_name SET col_name=expr1,
col_name2=exp2 WHERE where_condition |
SELECT CURDATE(); |
SELECT 'yyyy-mm-dd' + INTERVAL 10000 DAY (year, month,
second, minute, etc.); |
SELECT DATE_ADD( 'yyyy-mm-dd', INTERVAL 10000 DAY ); |
SELECT ADDDATE( 'yyyy-mm-dd', INTERVAL 10000 DAY ); |
SHOW STATUS;
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_key_buffer_size |
SHOW VARIABLES;
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html |
SET STORAGE_ENGINE=MyISAM;
SET STORAGE_ENGINE=InnoDB;
http://www.rackspace.com/knowledge_center/article/mysql-engines-myisam-vs-innodb |
SET GLOBAL key_buffer_size=4*1024*1024
http://dev.mysql.com/doc/refman/5.0/en/structured-system-variables.html |
shell> mysqld_safe |
--key_buffer_size=64M
--table_open_cache=256 \
--sort_buffer_size=4M
--read_buffer_size=1M &
|
|