改密碼的方法:
Basic
建立資料庫
CREATE DATABASE db_name;使用資料庫
USE db_name;刪除資料庫
DROP DATABASE [IF EXISTS] db_name;建立資料表
CREATE TABLE table_name (
column1 data_type,
column2 data_type,
...
);ZEROFILL屬性:
在定義數字類型的欄位時,有時會希望左邊要補 0,如 INT(3) 在資料是 1 時,輸出會是 001。這時只要屬性加入 ZEROFILL 即可。而加入 ZEROFILL 屬性時,UNSIGNED 也會強制被加入。
CREATE TABLE test (
test_id INT(3) UNSIGNED ZEROFILL
)
ZEROFILL好像是 MySQL 專屬功能,其他資料庫只能個別實作了。
MySQL Command-Line
When Select many fields, there’s better way to display in terminal by add pager option:
mysql --pager="less --chop-long-lines --quit-if-one-screen --no-init"Log
-- setting
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'TABLE' ;
-- show
SELECT * FROM mysql.general_log;