====== mysql ======
===== Add a user =====
[[https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql|source]]
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
===== Grant multiple permissions =====
GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;
===== Revoke permissions =====
REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’
===== Delete user =====
DROP USER ‘demo’@‘localhost’;
===== table size =====
SELECT table_schema,round(sum(data_length+index_length)/1024/1024,4) FROM information_schema.tables WHERE table_schema = 'beta_grid' AND table_name = 'assets';
===== user config file =====
in ~/.my.cnf
[client]
host = localhost
user = myusername
password = mypassword
socket = /var/run/mysqld/mysqld.sock
[mysqld]
# Performance settings used for import.
delay_key_write=ALL
bulk_insert_buffer_size=256M
{{tag>cli mysql}}