久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

目前學習到的常用命令之Mariadb

瀏覽:72日期:2023-03-30 13:34:15
在諸如Debian上,安裝mariadb。

sudo apt install mariadb-server mariadb-client
檢查相應數(shù)據(jù)庫版本。

mysqladmin --version
修改數(shù)據(jù)庫密碼。

mysqladmin -u root password "{yourpassword}";
用賬號密碼,登錄數(shù)據(jù)庫。

mysql -u root -p
用root用戶打開mariadb。

sudo mariadb

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type "help;" or "\h" for help. Type "\c" to clear the current input statement.
下面是在數(shù)據(jù)庫之命令行界面中操作,不是Linux本身之終端。

使用某個數(shù)據(jù)庫。

use mysql
顯示當前數(shù)據(jù)庫。

show databases;
創(chuàng)建數(shù)據(jù)庫。

CREATE DATABASE test;
刪除特定表。

DROP TABLE products_tbl
顯示表中的列。

SHOW COLUMNS FROM tbl;
選中表中的全部。

SELECT * from tbl
顯示特定列,從特定表。

SELECT name from tbl;
顯示特定列,從特定的庫和表。

SELECT name from test.tbl;
顯示特定列,從特定的庫和表,根據(jù)特定的列之值。

SELECT name from test.tbl WHERE name = "好吧啦";
查看表結(jié)構(gòu)。

desc tbl
改變特定表,增加特定列。

alter table tbl add age int(10);
更新表,設(shè)置特定列的值,位置是某列的值所對應的。

UPDATE tbl SET age = 61 WHERE id=981;
UPDATE tbl SET age = 65 WHERE name="Marx";
刪除,從特定表,位置是某列的值所對應的。

delete from tbl where id=211;
創(chuàng)建表,設(shè)定各列。

CREATE TABLE economists(  
-> id INT NOT NULL AUTO_INCREMENT,
-> name VARCHAR(100) NOT NULL,
-> born DATE,
-> dead DATE,
-> book VARCHAR(100) NOT NULL,
-> PRIMARY KEY (id)
-> );
顯示當前數(shù)據(jù)庫中的表。

show tables;
展示列,從特定的表。

SHOW COLUMNS FROM economists;
向特定表中插入數(shù)據(jù)。

INSERT INTO tbl (id, name) VALUES(981, "好吧啦");
INSERT INTO tbl (id, name, age) VALUES(1818, "Marx", 88);
INSERT INTO economists (id, name, born, dead, book) VALUES(0, "Karl Marx", "1818-05-05", "1883-03-14", "Das Kapital");
相關(guān)文章:
主站蜘蛛池模板: 锡林浩特市| 马山县| 盐亭县| 峨眉山市| 潜山县| 眉山市| 乌鲁木齐县| 建湖县| 东明县| 南安市| 柳江县| 连城县| 尉犁县| 营山县| 苏尼特左旗| 依兰县| 汉沽区| 灵山县| 徐州市| 镇雄县| 安庆市| 若羌县| 金秀| 太康县| 大兴区| 成武县| 永春县| 武冈市| 秦安县| 达尔| 鄂尔多斯市| 田东县| 遂川县| 长沙市| 仁寿县| 高密市| 肇东市| 天镇县| 绥德县| 定陶县| 应用必备|