MariaDB リファレンス

MariaDB Server Documentation

https://mariadb.com/kb/en/library/documentation/

ALTER TABLE

既存テーブルのカラム追加・削除、名称・値変更などのテーブル操作コマンド。

https://www.techonthenet.com/mariadb/tables/alter_table.php

ex)

mariadb[database] > ALTER TABLE websites ADD host_name varchar(40) AFTER server_name;

Encryption

MD5

https://www.techonthenet.com/mariadb/functions/md5.php

SELECT MD5('TechOnTheNet.com'); *Result:* 'fd1e59d32b528f2172d899a6a3111d47' 
SELECT MD5('secret word'); *Result:* '74a11ef33c5252edfa87c4eb8b566c2a' 
SELECT MD5('password'); *Result:* '5f4dcc3b5aa765d61d8327deb882cf99' 
SELECT MD5(NULL); *Result:* NULL
SELECT MD5('testing');
+----------------------------------+
| MD5('testing')                   |
+----------------------------------+
| ae2b1fca515949e5d54fb22b8ed95575 |
+----------------------------------+

SHA2

Ex)

SELECT SHA2('Maria',224);
+----------------------------------------------------------+
| SHA2('Maria',224)                                        |
+----------------------------------------------------------+
| 6cc67add32286412efcab9d0e1675a43a5c2ef3cec8879f81516ff83 |
+----------------------------------------------------------+

SELECT SHA2('Maria',256);
+------------------------------------------------------------------+
| SHA2('Maria',256)                                                |
+------------------------------------------------------------------+
| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |
+------------------------------------------------------------------+

SELECT SHA2('Maria',0);
+------------------------------------------------------------------+
| SHA2('Maria',0)                                                  |
+------------------------------------------------------------------+
| 9ff18ebe7449349f358e3af0b57cf7a032c1c6b2272cb2656ff85eb112232f16 |
+------------------------------------------------------------------+

UPDATE

https://www.techonthenet.com/mariadb/update.php

Ex)

Single-table syntax:

UPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;

Multiple-table syntax:

UPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE tab1.id

MariaDB: CREATE USER statement


https://www.techonthenet.com/mariadb/users/create_user.php

MariaDB: Grant/Revoke Privileges


https://www.techonthenet.com/mariadb/grant_revoke.php

Ex) 特権ユーザ:dba,ホストネームは任意:ワイルドカード’%'

CREATE USER 'dba'@'%' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON *.* TO 'dba'@'%' ;

Mariadb socket確認

# mysqladmin -p -u tk-fuse variables | grep socket