RH134-第二十节-Mariadb数据库

2023-12-28 08:58

本文主要是介绍RH134-第二十节-Mariadb数据库,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

安装数据库

yum install mariadb-server.x86_64 -y
systemctl start mariadb
systemctl enable mariadb
vim /etc/my.cnf
skip-networking=1
mysql_secure_installation
Enter

进入数据库

mysql -uroot -p ##登陆数据库
show databases; ##显示所有数据库
mysql -uroot -phubo -e ”show databases;“ ##直接查看所有数据库
use westos; ##使用westos数据库
show tables; ##显示表格
select * from linux; ##从linux表格里获取所有信息


[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> show tables;
+—————————+
| Tables_in_mysql |
+—————————+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+—————————+
24 rows in set (0.00 sec)

MariaDB [mysql]> select * from user

创建数据库

create database westos;
use westos;
careat table linux ( ## (表示换行
name varchar(50) not null, ##表示not null不能为空
age varchar(50) not null,
school varchar(50) not null,
sex varchar(20) ); ## 没有not null 表示录入的时候这一项可以为空
insert into linux values (‘lee’,’25’,’xupt’,’man’);
select * from linux;


[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
MariaDB [linux]> show tables ;
Empty set (0.00 sec)

MariaDB [linux]> create table mn (
-> age varchar(50),
-> sex varchar(50),
-> school varchar(20));
Query OK, 0 rows affected (0.36 sec)

MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| mn |
+—————–+

MariaDB [linux]> insert into mn (‘20’,’man’,’XUPT’); ##少了一个values报错
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”20’,’man’,’XUPT’)’ at line 1

MariaDB [linux]> insert into mn values (‘20’,’man’,’XUPT’); ##重新导入数据
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from mn;
+——+——+——–+
| age | sex | school |
+——+——+——–+
| 20 | man | XUPT |
+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

修改数据库相关

alter table mn rename info; ##重命名表格mn为info
alter table mn add tele varchar(50) after sex; ##在表格里面添加tele信息并排在sex后面
update info set tele=’12345678’; ##更新tele里面的信息为123456(所有)
update info set tele=’1234151’ where username=’sarah’; ##更新sarah的tele信息为1234151


MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| mn |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table mn rename info;
Query OK, 0 rows affected (0.34 sec)

MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| info |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> select * from info;
+——+——+——–+
| age | sex | school |
+——+——+——–+
| 20 | man | XUPT |
+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table info add tele varchar(50) after sex;
Query OK, 1 row affected (0.39 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+——+——–+
| age | sex | tele | school |
+——+——+——+——–+
| 20 | man | NULL | XUPT |
+——+——+——+——–+
1 row in set (0.00 sec)

MariaDB [linux]> update info set tele=’12345678’;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

备份数据库相关

mysqldump -uroot -phubo –all-database >/mnt/database.qsl ##备份数据库所有的数据到指定目录的指定文件
mysqldump -uroot -phubo linux >/mnt/linux.sql ##备份linux数据库到指定目录指定文件
mysqldump -uroot -phubo –no-databases >/mnt/database.qsl ##只备份数据库的表格,不备份数据
mysql -uroot -phubo -e ‘create database linux;’ ##新建数据库linux
mysql -uroot -phubo linux < /mnt/linux.sql ##将备份的导入到新建的linux数据库里


[root@localhost ~]# mysqldump -uroot -phubo –all-database >/mnt/database.qsl ##备份数据库所有的数据到指定目录的指定文件
[root@localhost ~]# ls /mnt/
database.qsl linux.sql
[root@localhost ~]# vim /mnt/database.qsl
[root@localhost ~]# mysqldump -uroot -phubo linux >/mnt/linux.sql
[root@localhost ~]# ls /mnt/
database.qsl linux.sql
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> drop linux;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘linux’ at line 1
MariaDB [(none)]> drop database linux;
Query OK, 1 row affected (0.04 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]> create database linux; ##这一步可以直接在shell里完成(mysqldump -uroot -phubo -e ’ create database linux;’)
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [(none)]> Bye
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Database changed
MariaDB [linux]> show tables;
Empty set (0.00 sec)

MariaDB [linux]> Bye
[root@localhost ~]# mysql -uroot -phubo linux < /mnt/linux.sql
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [linux]> show tables;
+—————–+
| Tables_in_linux |
+—————–+
| info |
+—————–+
1 row in set (0.00 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]>

删除数据库相关

drop database linux; ##删除linux的数据库(包含里面的tables)
drop table info ; ##删除info表格
delate from info where age=’20’; ##删除info表格里age=20的数据
delate from info where age=’20’ and name=’peter’ ##删除info表格里age=20和name=peter的数据


[root@localhost ~]# mysql -uroot -phubo
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use linux;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [linux]> select * from info;
+——+——+———-+——–+
| age | sex | tele | school |
+——+——+———-+——–+
| 20 | man | 12345678 | XUPT |
+——+——+———-+——–+
1 row in set (0.00 sec)

MariaDB [linux]> alter table info add name varchar(50);
Query OK, 1 row affected (0.45 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [linux]> select * from info;
+——+——+———-+——–+——+
| age | sex | tele | school | name |
+——+——+———-+——–+——+
| 20 | man | 12345678 | XUPT | NULL |
+——+——+———-+——–+——+
1 row in set (0.00 sec)

MariaDB [linux]> insert into info values (”,”,”,”,’peter’);
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+——-+
| age | sex | tele | school | name |
+——+——+———-+——–+——-+
| 20 | man | 12345678 | XUPT | NULL |
| | | | | peter |
+——+——+———-+——–+——-+
2 rows in set (0.00 sec)

MariaDB [linux]> delete from info where name=’peter’;
Query OK, 1 row affected (0.04 sec)

MariaDB [linux]> select * from info;
+——+——+———-+——–+——+
| age | sex | tele | school | name |
+——+——+———-+——–+——+
| 20 | man | 12345678 | XUPT | NULL |
+——+——+———-+——–+——+
1 row in set (0.00 sec)

MariaDB [linux]> insert into info values (‘23’,’men’,’147258233’,’Normal University’,’peter’);
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———–+——————-+——-+
| age | sex | tele | school | name |
+——+——+———–+——————-+——-+
| 20 | man | 12345678 | XUPT | NULL |
| 23 | men | 147258233 | Normal University | peter |
+——+——+———–+——————-+——-+
2 rows in set (0.00 sec)

MariaDB [linux]> delete from info where age=’20’;
Query OK, 1 row affected (0.34 sec)

MariaDB [linux]> select * from info;
+——+——+———–+——————-+——-+
| age | sex | tele | school | name |
+——+——+———–+——————-+——-+
| 23 | men | 147258233 | Normal University | peter |
+——+——+———–+——————-+——-+

MariaDB [linux]> drop table info;
Query OK, 0 rows affected (0.34 sec)

MariaDB [linux]> show tables;
Empty set (0.00 sec)

MariaDB [linux]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| linux |
| mysql |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)

MariaDB [linux]> drop database linux;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]>

重置mysql root密码

systemctl stop mariadb ##停止数据库
mysqld_safe –skip-grant-tables & ##开启数据库不启动授权表
kill -9 进程号 ##结束数据库进程
mysql ->use mysql->update user set Password=password(‘redhat’) where User=’root’;[update user set Password=’redhat’ where User=’root’;这种设置是为加密的密码,密码会裸露出来,不安全,故采用第一种] ##进入数据路的操作
systemctl restart maiadb ##重启数据库


ot@localhost ~]# systemctl stop mariadb
[root@localhost ~]# ps -aux |grep mysql
root 3905 0.0 0.0 112640 976 pts/1 S+ 02:51 0:00 grep –color=auto mysql
[root@localhost ~]# mysqld_safe –skip-grant-tables &
[1] 3906
[root@localhost ~]# 170812 02:51:36 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
170812 02:51:36 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql ##这里会停住,按一下enter,让其继续运行

[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> update user set Password=password(‘westos’) where User=’root’;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

MariaDB [mysql]> Bye

[root@localhost ~]# ps -aux |grep mysql
root 3906 0.0 0.1 113256 1644 pts/1 S 02:51 0:00 /bin/sh /usr/bin/mysqld_safe –skip-grant-tables
mysql 4235 1.7 8.7 791148 88712 pts/1 Sl 02:54 0:00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –skip-grant-tables –log-error=/var/log/mariadb/mariadb.log –pid-file=/var/run/mariadb/mariadb.pid –socket=/var/lib/mysql/mysql.sock
root 4257 0.0 0.0 112640 980 pts/1 R+ 02:54 0:00 grep –color=auto mysql
[root@localhost ~]# kill -9 3906 ##关闭mysald_safe的进程
[root@localhost ~]# kill -9 4235 ##关闭mysald_safe的进程,先关闭第一个,再关闭第二个
[1]+ Killed mysqld_safe –skip-grant-tables
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
[root@localhost ~]# mysql -uroot -pwestos
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

MariaDB [(none)]>

创建用户和用户授权

CREATE USER lee@localhost identified by ‘lee’; ##创建本地用户lee并且密码为lee(by后面的为密码)
CREATE USER lee@’%’ identified by ‘lee’; ##创建本地和远程都可以登陆用户lee,密码lee
用户授权
GRANT INSERT,UPDATE,DELETE,SELECT,DROP on linux.* to lee@localhost; ##授予本地用户lee@localhost:导入….删除等权限在linux数据库上
重载授权表
FLUSH PRIVILEGES;
查看用户授权表
SHOW GRANTS FOR lee@localhost
撤销用户权限
REVOKE INSERT,UPDATE,DELETE,SELECT,DROP on westos.* from lee@localhost;
删除用户
DROP USER lee@localhost;


MariaDB [(none)]> create user lee@’%’ identified by ‘lee’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant insert,update,delate,drop,select on linux.* to lee@’%’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘delate,drop,select on linux.* to lee@’%” at line 1
(delete 打错了,报错)
MariaDB [(none)]> grant insert,update,delete,drop,select on linux.* to lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for lee@’%’;
+—————————————————————————————————-+
| Grants for lee@% |
+—————————————————————————————————-+
| GRANT USAGE ON . TO ‘lee’@’%’ IDENTIFIED BY PASSWORD ‘*9BB439A3A652A9DAD3718215F77A7AA06108A267’ |
| GRANT SELECT, INSERT, UPDATE, DELETE, DROP ON linux.* TO ‘lee’@’%’ |
+—————————————————————————————————-+
2 rows in set (0.00 sec)

MariaDB [(none)]> revoke UPDATE, DELETE on linux.* from lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants for lee@’%’;
+—————————————————————————————————-+
| Grants for lee@% |
+—————————————————————————————————-+
| GRANT USAGE ON . TO ‘lee’@’%’ IDENTIFIED BY PASSWORD ‘*9BB439A3A652A9DAD3718215F77A7AA06108A267’ |
| GRANT SELECT, INSERT, DROP ON linux.* TO ‘lee’@’%’ |
+—————————————————————————————————-+
2 rows in set (0.00 sec)

MariaDB [(none)]> drop user lee@’%’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>

mysql图形化管理工具phpmysql

yum install mariadb httpd php php-mysql -y ##安装必要的软件
get /var/www/html/phpMyAdmin-3.4.0-all-languages.tar.bz2 ##下phpmyadmin软件包
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 ##解包
phpMyAdmin-3.4.0-all-languages ##解压得到的文件夹
mv phpMyAdmin-3.4.0-all-languages mariadbadmin ##重命名目录
less Documentation.txt ##查看安装说明
cp config.sample.inc.php config.inc.php ##按照说明重命名这个文件
vim config.inc.php
$cfg[‘blowfish_secret’]= ‘ba17clec07d65003’;
systemctl restart httpd
systemctl stop firewalld

测试
httpd://localhost/mysqladmin


[root@foundation23 Desktop]# tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 -C /var/www/html/
[root@foundation23 Desktop]# cd /var/www/html/
[root@foundation23 html]# ls
index.html ks1 phpmyadmin redhat7
ks ks.cfg phpMyAdmin-3.4.0-all-languages redhat72
[root@foundation23 html]# mv phpMyAdmin-3.4.0-all-languages/ mysqladmin
[root@foundation23 html]# ls
index.html ks ks1 ks.cfg mysqladmin redhat7 redhat72
[root@foundation23 html]# cd mysqladmin/
[root@foundation23 mysqladmin]# cp config.sample.inc.php config.inc.php
[root@foundation23 mysqladmin]# less Documentation.txt
[root@foundation23 mysqladmin]# vim config.inc.php
[root@foundation23 mysqladmin]# yum install php php-mysql -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
redhat72 | 4.1 kB 00:00
software | 2.9 kB 00:00
Package php-5.4.16-36.el7_1.x86_64 already installed and latest version
Package php-mysql-5.4.16-36.el7_1.x86_64 already installed and latest version
Nothing to do
[root@foundation23 mysqladmin]# systemctl restart httpd.service
[root@foundation23 mysqladmin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)

Aug 12 15:35:55 foundation23.ilt.example.com systemd[1]: Stopped firewalld - …
Hint: Some lines were ellipsized, use -l to show in full.
[root@foundation23 mysqladmin]# systemctl restart mariadb.service
这里写图片描述
这里写图片描述
这里写图片描述

这篇关于RH134-第二十节-Mariadb数据库的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/545471

相关文章

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

C#连接SQL server数据库命令的基本步骤

《C#连接SQLserver数据库命令的基本步骤》文章讲解了连接SQLServer数据库的步骤,包括引入命名空间、构建连接字符串、使用SqlConnection和SqlCommand执行SQL操作,... 目录建议配合使用:如何下载和安装SQL server数据库-CSDN博客1. 引入必要的命名空间2.

Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式

《Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式》本文详细介绍如何使用Java通过JDBC连接MySQL数据库,包括下载驱动、配置Eclipse环境、检测数据库连接等关键步骤,... 目录一、下载驱动包二、放jar包三、检测数据库连接JavaJava 如何使用 JDBC 连接 mys

MySQL数据库中ENUM的用法是什么详解

《MySQL数据库中ENUM的用法是什么详解》ENUM是一个字符串对象,用于指定一组预定义的值,并可在创建表时使用,下面:本文主要介绍MySQL数据库中ENUM的用法是什么的相关资料,文中通过代码... 目录mysql 中 ENUM 的用法一、ENUM 的定义与语法二、ENUM 的特点三、ENUM 的用法1

Java中调用数据库存储过程的示例代码

《Java中调用数据库存储过程的示例代码》本文介绍Java通过JDBC调用数据库存储过程的方法,涵盖参数类型、执行步骤及数据库差异,需注意异常处理与资源管理,以优化性能并实现复杂业务逻辑,感兴趣的朋友... 目录一、存储过程概述二、Java调用存储过程的基本javascript步骤三、Java调用存储过程示

Go语言数据库编程GORM 的基本使用详解

《Go语言数据库编程GORM的基本使用详解》GORM是Go语言流行的ORM框架,封装database/sql,支持自动迁移、关联、事务等,提供CRUD、条件查询、钩子函数、日志等功能,简化数据库操作... 目录一、安装与初始化1. 安装 GORM 及数据库驱动2. 建立数据库连接二、定义模型结构体三、自动迁

嵌入式数据库SQLite 3配置使用讲解

《嵌入式数据库SQLite3配置使用讲解》本文强调嵌入式项目中SQLite3数据库的重要性,因其零配置、轻量级、跨平台及事务处理特性,可保障数据溯源与责任明确,详细讲解安装配置、基础语法及SQLit... 目录0、惨痛教训1、SQLite3环境配置(1)、下载安装SQLite库(2)、解压下载的文件(3)、

MySQL数据库的内嵌函数和联合查询实例代码

《MySQL数据库的内嵌函数和联合查询实例代码》联合查询是一种将多个查询结果组合在一起的方法,通常使用UNION、UNIONALL、INTERSECT和EXCEPT关键字,下面:本文主要介绍MyS... 目录一.数据库的内嵌函数1.1聚合函数COUNT([DISTINCT] expr)SUM([DISTIN

MySQL追踪数据库表更新操作来源的全面指南

《MySQL追踪数据库表更新操作来源的全面指南》本文将以一个具体问题为例,如何监测哪个IP来源对数据库表statistics_test进行了UPDATE操作,文内探讨了多种方法,并提供了详细的代码... 目录引言1. 为什么需要监控数据库更新操作2. 方法1:启用数据库审计日志(1)mysql/mariad

postgresql数据库基本操作及命令详解

《postgresql数据库基本操作及命令详解》本文介绍了PostgreSQL数据库的基础操作,包括连接、创建、查看数据库,表的增删改查、索引管理、备份恢复及退出命令,适用于数据库管理和开发实践,感兴... 目录1. 连接 PostgreSQL 数据库2. 创建数据库3. 查看当前数据库4. 查看所有数据库