安装

debian 系统

安装命令:sudo apt install default-mysql-server,将会安装mariadb-servermariadb-client这两个软件包。

使用

创建用户

命令:CREATE USER 'username'@'host' IDENTIFIED BY 'password';

MariaDB [(none)]> create user 'user_test'@'%' identified by 'user_test';
Query OK, 0 rows affected (0.000 sec)

删除用户

命令:DROP USER 'username'@'host';

MariaDB [(none)]> drop user 'user_test'@'%';
Query OK, 0 rows affected (0.000 sec)

创建数据库

命令:CREATE DATABASE db_name;

MariaDB [(none)]> create database db_test;
Query OK, 1 row affected (0.001 sec)

设置权限

命令:GRANT ALL ON db_name.* TO 'username'@'host';

MariaDB [(none)]> grant all on db_test.* to 'user_test'@'%';
Query OK, 0 rows affected (0.001 sec)