MariaDB是一个流行的开源关系型数据库管理系统,它是MySQL的一个分支,广泛用于各种应用程序和网站。以下是关于MariaDB数据库的使用方法:
启动和停止服务:
systemctl start mariadb.service
systemctl stop mariadb.service
systemctl restart mariadb.service
用户登录:
mysql -uroot -p
,输入密码后即可登录。创建和删除用户:
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
DROP USER 'username'@'host';
查看和修改权限:
SHOW GRANTS FOR 'username'@'host';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'host';
查看和创建数据库:
SHOW DATABASES;
CREATE DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci;
增删改查操作:
INSERT INTO table_name (column1, column2, …) VALUES (value1, value2, …);
SELECT column1, column2, … FROM table_name WHERE condition;
UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition;
DELETE FROM table_name WHERE condition;
SHOW DATABASES;
命令。CREATE USER 'username'@'host' IDENTIFIED BY 'password';
命令。SELECT HOST, USER, PASSWORD FROM mysql.user WHERE USER = 'username';
命令。通过以上步骤,您可以开始使用MariaDB数据库进行基本的数据库操作和管理。请确保在操作过程中注意数据安全和备份。