MariaDB (MySQL)

技術筆記

安裝

sudo apt install mariadb-server

sudo mysql # 第一次進入

使用者

SET PASSWORD = PASSWORD('new_password');
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'*' IDENTIFIED BY 'password';
GRANT command PRIVILEGES ON db.table TO 'username'@'localhost' IDENTIFIED BY 'password';
DROP USER IF EXISTS user

操作

Create New DB

find here

CREATE DATABASE testDB;

Drop DB / table / column / row

DROP DATABASE "db_name"; # DB
DROP TABLE "table_name"; -- table
ALTER TABLE "table_name" DROP "column_name"; /* column */
DELETE FROM "table_name" WHERE condition;

Use .sql file

mysql -p < xxx.sql

Dump DB in / out

  • in
mysqlimport --ignore-lines=1 --fields-terminated-by=, --verbose --local -u [user] -p [database] /path/to/address.csv

參考

  • out
comments powered by Disqus

Related