MariaDB是一個流行的開源關系型數(shù)據(jù)庫管理系統(tǒng),它是MySQL的一個分支,廣泛用于各種應用程序和網(wǎng)站。以下是關于MariaDB數(shù)據(jù)庫的使用方法:
啟動和停止服務:
systemctl start mariadb.service
systemctl stop mariadb.service
systemctl restart mariadb.service
用戶登錄:
mysql -uroot -p
,輸入密碼后即可登錄。創(chuàng)建和刪除用戶:
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
DROP USER 'username'@'host';
查看和修改權限:
SHOW GRANTS FOR 'username'@'host';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'host';
查看和創(chuàng)建數(shù)據(jù)庫:
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數(shù)據(jù)庫進行基本的數(shù)據(jù)庫操作和管理。請確保在操作過程中注意數(shù)據(jù)安全和備份。