mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
8aa7ca5fe6
@ -1,17 +1,18 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "lxbwolf"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-12822-1.html"
|
||||
[#]: subject: "Improve your database knowledge with this MariaDB and MySQL cheat sheet"
|
||||
[#]: via: "https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
|
||||
使用这个 MariaDB 和 MySQL 备忘单提升你的数据库技能
|
||||
备忘单:提升你的 MariaDB 和 MySQL 数据库技能
|
||||
======
|
||||
|
||||
阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。
|
||||
![Cheat Sheet cover image][1]
|
||||
> 阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202011/14/065421hq1qocmk3rf4npq1.jpg)
|
||||
|
||||
当你写一个程序或配置一个服务时,你最终都要持久化存储信息。有时候,你只需要一个 INI 或者 [YAML][2] 配置文件就够了。而有时候,一个自定义格式的 XML 或者 JSON 或其他类似的文件会更好。
|
||||
|
||||
@ -25,7 +26,6 @@
|
||||
|
||||
你可以使用 `mysql` 命令与 MariaDB 进行交互。首先使用子命令 `ping` 确认你的服务是运行着的,在提示后输入密码:
|
||||
|
||||
|
||||
```
|
||||
$ mysqladmin -u root -p ping
|
||||
Enter password:
|
||||
@ -34,7 +34,6 @@ mysqld is alive
|
||||
|
||||
为了易于读者理解,打开一个交互式的 MariaDB 会话:
|
||||
|
||||
|
||||
```
|
||||
$ mysql -u root -p
|
||||
Enter password:
|
||||
@ -44,20 +43,19 @@ Commands end with ; or \g.
|
||||
Type 'help;' or '\h' for help.
|
||||
Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [(none)]>
|
||||
MariaDB [(none)]>
|
||||
```
|
||||
|
||||
你现在是在一个 MariaDB 子 shell 中,提示框是 MariaDB 提示框。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。
|
||||
你现在是在一个 MariaDB 子 shell 中,提示符是 MariaDB 提示符。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。
|
||||
|
||||
### 学习 SQL 基本知识
|
||||
|
||||
[结构化查询语言][8] 是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。
|
||||
[结构化查询语言][8]是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容以得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。
|
||||
|
||||
SQL 命令以分号作为结尾。如果你忘记输入分号,MariaDB 会认为你是想在下一行继续输入你的查询命令,在下一行你可以继续输入命令也可以输入分号结束命令。
|
||||
|
||||
|
||||
```
|
||||
MariaDB [(NONE)]> SHOW DATABASES;
|
||||
MariaDB [(NONE)]> SHOW DATABASES;
|
||||
+--------------------+
|
||||
| DATABASE |
|
||||
+--------------------+
|
||||
@ -69,32 +67,29 @@ MariaDB [(NONE)]> SHOW DATABASES;
|
||||
4 ROWS IN SET (0.000 sec)
|
||||
```
|
||||
|
||||
上面的例子显示当前有四个数据库:information_schema、mysql、performance_schema 和 test。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。
|
||||
|
||||
上面的例子显示当前有四个数据库:`information_schema`、`mysql`、`performance_schema` 和 `test`。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。
|
||||
|
||||
```
|
||||
MariaDB [(NONE)]> USE test;
|
||||
MariaDB [(test)]>
|
||||
MariaDB [(NONE)]> USE test;
|
||||
MariaDB [(test)]>
|
||||
```
|
||||
|
||||
#### 显示数据库的表
|
||||
|
||||
数据库里有_表_,与电子表格类似:有一系列的行(在数据库中称为_记录_)和列。一个行和一个列唯一确定一个 _filed_。
|
||||
|
||||
查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`:
|
||||
数据库里有*表*,与电子表格类似:有一系列的行(在数据库中称为*记录*)和列。一个行和一个列唯一确定一个*字段*。
|
||||
|
||||
查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`:
|
||||
|
||||
```
|
||||
MariaDB [(test)]> SHOW TABLES;
|
||||
MariaDB [(test)]> SHOW TABLES;
|
||||
empty SET
|
||||
```
|
||||
|
||||
`test` 数据库是空的,所以使用 `use` 命令切换到 `mysql` 数据库:
|
||||
|
||||
|
||||
```
|
||||
MariaDB [(test)]> USE mysql;
|
||||
MariaDB [(mysql)]> SHOW TABLES;
|
||||
MariaDB [(test)]> USE mysql;
|
||||
MariaDB [(mysql)]> SHOW TABLES;
|
||||
|
||||
+---------------------------+
|
||||
| Tables_in_mysql |
|
||||
@ -114,12 +109,11 @@ MariaDB [(mysql)]> SHOW TABLES;
|
||||
|
||||
#### 检查一个表
|
||||
|
||||
这个实例的 `mysql` 数据库的最后一个表名为 `user`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性:
|
||||
|
||||
这个实例的 `mysql` 数据库的最后一个表名为 `USER`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性:
|
||||
|
||||
```
|
||||
> SHOW COLUMNS IN USER;
|
||||
MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
> SHOW COLUMNS IN USER;
|
||||
MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
+-------------+---------------+------+-----+----------+
|
||||
| FIELD | TYPE | NULL | KEY | DEFAULT |
|
||||
+-------------+---------------+------+-----+----------+
|
||||
@ -138,20 +132,18 @@ MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
|
||||
#### 创建一个新的用户
|
||||
|
||||
不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `user` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息:
|
||||
|
||||
不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `USER` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息:
|
||||
|
||||
```
|
||||
`> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';`
|
||||
> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password';
|
||||
```
|
||||
|
||||
#### 查看表的字段
|
||||
|
||||
你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `user` 表中的列:
|
||||
|
||||
你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `USER` 表中的列:
|
||||
|
||||
```
|
||||
> SELECT USER,host FROM USER;
|
||||
> SELECT USER,host FROM USER;
|
||||
+------+------------+
|
||||
| USER | host |
|
||||
+------+------------+
|
||||
@ -164,11 +156,10 @@ MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
|
||||
#### 为一个用户赋予权限
|
||||
|
||||
通过查看 `user` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。
|
||||
|
||||
通过查看 `USER` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。
|
||||
|
||||
```
|
||||
> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux';
|
||||
> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux';
|
||||
+------+-------------+-------------+-------------+
|
||||
| USER | select_priv | insert_priv | update_priv |
|
||||
+------+-------------+-------------+-------------+
|
||||
@ -178,17 +169,15 @@ MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
|
||||
使用 `GRANT` 命令修改用户的权限:
|
||||
|
||||
|
||||
```
|
||||
> GRANT SELECT ON *.* TO 'tux'@'localhost';
|
||||
> FLUSH PRIVILEGES;
|
||||
> GRANT SELECT ON *.* TO 'tux'@'localhost';
|
||||
> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
验证你的修改:
|
||||
|
||||
|
||||
```
|
||||
> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux';
|
||||
> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux';
|
||||
+------+-------------+-------------+-------------+
|
||||
| USER | select_priv | insert_priv | update_priv |
|
||||
+------+-------------+-------------+-------------+
|
||||
@ -206,11 +195,10 @@ MariaDB [mysql]> SHOW COLUMNS IN USER;
|
||||
|
||||
你可能已经可以自己在 MariaDB 中创建新数据库了。创建数据库跟新建用户差不多。
|
||||
|
||||
|
||||
```
|
||||
> CREATE DATABASE example;
|
||||
> CREATE DATABASE example;
|
||||
Query OK, 1 ROW affected (0.000 sec)
|
||||
> SHOW DATABASES;
|
||||
> SHOW DATABASES;
|
||||
+--------------------+
|
||||
| DATABASE |
|
||||
+--------------------+
|
||||
@ -220,9 +208,8 @@ Query OK, 1 ROW affected (0.000 sec)
|
||||
|
||||
使用 `use` 命令来把这个新建的数据库作为当前使用的库:
|
||||
|
||||
|
||||
```
|
||||
`> USE example;`
|
||||
> USE example;
|
||||
```
|
||||
|
||||
#### 创建一个表
|
||||
@ -231,12 +218,11 @@ Query OK, 1 ROW affected (0.000 sec)
|
||||
|
||||
下面是用来描述一系列用户的一个简单的表:
|
||||
|
||||
|
||||
```
|
||||
> CREATE TABLE IF NOT EXISTS member (
|
||||
-> id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
-> name VARCHAR(128) NOT NULL,
|
||||
-> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
|
||||
> CREATE TABLE IF NOT EXISTS member (
|
||||
-> id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
-> name VARCHAR(128) NOT NULL,
|
||||
-> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
|
||||
Query OK, 0 ROWS affected (0.030 sec)
|
||||
```
|
||||
|
||||
@ -244,23 +230,21 @@ Query OK, 0 ROWS affected (0.030 sec)
|
||||
|
||||
使用 SQL 关键字 `INSERT` 向这个表填充一些示例数据:
|
||||
|
||||
|
||||
```
|
||||
> INSERT INTO member (name) VALUES ('Alice');
|
||||
> INSERT INTO member (name) VALUES ('Alice');
|
||||
Query OK, 1 ROW affected (0.011 sec)
|
||||
> INSERT INTO member (name) VALUES ('Bob');
|
||||
> INSERT INTO member (name) VALUES ('Bob');
|
||||
Query OK, 1 ROW affected (0.011 sec)
|
||||
> INSERT INTO member (name) VALUES ('Carol');
|
||||
> INSERT INTO member (name) VALUES ('Carol');
|
||||
Query OK, 1 ROW affected (0.011 sec)
|
||||
> INSERT INTO member (name) VALUES ('David');
|
||||
> INSERT INTO member (name) VALUES ('David');
|
||||
Query OK, 1 ROW affected (0.011 sec)
|
||||
```
|
||||
|
||||
验证一下表里的数据:
|
||||
|
||||
|
||||
```
|
||||
> SELECT * FROM member;
|
||||
> SELECT * FROM member;
|
||||
+----+-------+---------------------+
|
||||
| id | name | startdate |
|
||||
+----+-------+---------------------+
|
||||
@ -276,23 +260,21 @@ Query OK, 1 ROW affected (0.011 sec)
|
||||
|
||||
再创建一个表:
|
||||
|
||||
|
||||
```
|
||||
> CREATE TABLE IF NOT EXISTS linux (
|
||||
-> id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
-> distro VARCHAR(128) NOT NULL,
|
||||
> CREATE TABLE IF NOT EXISTS linux (
|
||||
-> id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
-> distro VARCHAR(128) NOT NULL);
|
||||
Query OK, 0 ROWS affected (0.030 sec)
|
||||
```
|
||||
|
||||
填充一些示例数据,这次使用 `VALUES` 快捷方式,这样你可以一次添加多行数据。`VALUES` 关键字需要一个用括号包围的列表作为参数,也可以用逗号分隔的多个列表作为参数。
|
||||
|
||||
|
||||
```
|
||||
> INSERT INTO linux (distro)
|
||||
-> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian');
|
||||
> INSERT INTO linux (distro)
|
||||
-> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian');
|
||||
Query OK, 4 ROWS affected (0.011 sec)
|
||||
Records: 4 Duplicates: 0 Warnings: 0
|
||||
> SELECT * FROM linux;
|
||||
> SELECT * FROM linux;
|
||||
+----+-----------+
|
||||
| id | distro |
|
||||
+----+-----------+
|
||||
@ -309,14 +291,13 @@ Records: 4 Duplicates: 0 Warnings: 0
|
||||
|
||||
你可以在表一中新增一列对应表二中的值。因为两个表都有唯一的标识符(自动递增的 `id` 字段),关联的它们的最简单的方式是,使用表一中的 `id` 字段作为表二的查询条件。
|
||||
|
||||
在表一中创建一列用来表示表二中的一个值。
|
||||
|
||||
在表一中创建一列用来表示表二中的一个值:
|
||||
|
||||
```
|
||||
> ALTER TABLE member ADD COLUMN (os INT);
|
||||
> ALTER TABLE member ADD COLUMN (os INT);
|
||||
Query OK, 0 ROWS affected (0.012 sec)
|
||||
Records: 0 Duplicates: 0 Warnings: 0
|
||||
> DESCRIBE member;
|
||||
> DESCRIBE member;
|
||||
DESCRIBE member;
|
||||
+-----------+--------------+------+-----+---------+------+
|
||||
| FIELD | TYPE | NULL | KEY | DEFAULT | Extra|
|
||||
@ -328,11 +309,10 @@ DESCRIBE member;
|
||||
+-----------+--------------+------+-----+---------+------+
|
||||
```
|
||||
|
||||
把 `linux` 表中的独一无二的 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询:
|
||||
|
||||
把 `linux` 表中的唯一 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询:
|
||||
|
||||
```
|
||||
> UPDATE member SET os=1 WHERE name='Alice';
|
||||
> UPDATE member SET os=1 WHERE name='Alice';
|
||||
Query OK, 1 ROW affected (0.007 sec)
|
||||
ROWS matched: 1 Changed: 1 Warnings: 0
|
||||
```
|
||||
@ -343,7 +323,6 @@ ROWS matched: 1 Changed: 1 Warnings: 0
|
||||
|
||||
现在这两个表彼此有了关联,你可以使用 SQL 来展示关联的数据。数据库中有很多种连接方式,你可以尽请尝试。下面的例子是关联 `member` 表中 `os` 字段和 `linux` 表中 `id` 字段:
|
||||
|
||||
|
||||
```
|
||||
SELECT * FROM member JOIN linux ON member.os=linux.id;
|
||||
+----+-------+---------------------+------+----+-----------+
|
||||
@ -359,9 +338,9 @@ SELECT * FROM member JOIN linux ON member.os=linux.id;
|
||||
|
||||
连接 `os` 和 `id` 字段。
|
||||
|
||||
在图像化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。
|
||||
在图形化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。
|
||||
|
||||
### [下载 MariaDB 和 MySQL 备忘单][9]
|
||||
### 下载 MariaDB 和 MySQL 备忘单
|
||||
|
||||
MariaDB 是企业级的数据库。它是健壮、强大、高效的数据库引擎。学习它是你向管理 web 应用和编写语言库迈出的伟大的一步。你可以[下载 MariaDB 和 MySQL 备忘单][9],在你使用 MariaDB 时可以快速参考。
|
||||
|
||||
@ -372,7 +351,7 @@ via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12823-1.html)
|
||||
[#]: subject: (GnuCash: A Powerful Open Source Accounting Software)
|
||||
[#]: via: (https://itsfoss.com/gnucash/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
@ -10,13 +10,15 @@
|
||||
GnuCash:一个强大的开源会计软件
|
||||
======
|
||||
|
||||
_**简介:GnuCash 是一款流行的免费开源会计软件,可用于管理个人财务和商业交易。**_
|
||||
> GnuCash 是一款流行的自由开源的会计软件,可用于管理个人财务和商业交易。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202011/14/070431j1547hbh3v2j4vhh.jpg)
|
||||
|
||||
考虑到管理个人财务和商业交易的复杂性,你会发现有很多旨在简化这些的在线服务或软件工具。有些工具只是让你添加支出和收入来跟踪你的储蓄,而其他一些工具则提供不同的功能。
|
||||
|
||||
我在过去已经介绍过几个[开源会计软件][1]。在这里,我将重点介绍其中一个 — **GnuCash**,它是一款很流行的免费会计软件,为所有用户提供了很多功能。
|
||||
|
||||
### GnuCash: 免费且开源的会计软件
|
||||
### GnuCash: 自由开源的会计软件
|
||||
|
||||
![][2]
|
||||
|
||||
@ -32,7 +34,7 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪
|
||||
|
||||
* 复式记账
|
||||
* 股票/债券/共同基金账户
|
||||
* 有税务支持的小企业会计(如印度的商品和服务税)
|
||||
* 有税务支持的小企业会计(如印度的商品和服务税)
|
||||
* 详细的分类报告
|
||||
* 便于分析的图表
|
||||
* 支持财务计算
|
||||
@ -49,8 +51,6 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪
|
||||
* 制定预算的能力
|
||||
* 配置账单生成器,以简化会计程序。
|
||||
|
||||
|
||||
|
||||
我不是专家,但这只是冰山一角。你会发现有很多选项可以根据你的会计需求进行定制和设置。
|
||||
|
||||
![Gnucash Report][4]
|
||||
@ -63,7 +63,7 @@ GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪
|
||||
|
||||
另外,你也可以从源码构建,或者你可以前往他们的[官方下载页面][8]来探索适合你的 Linux 发行版选项。
|
||||
|
||||
[GnuCash][9]
|
||||
- [GnuCash][9]
|
||||
|
||||
### 总结
|
||||
|
||||
@ -78,7 +78,7 @@ via: https://itsfoss.com/gnucash/
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,174 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 open source eBook readers for Android)
|
||||
[#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android)
|
||||
[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt)
|
||||
|
||||
4 open source eBook readers for Android
|
||||
======
|
||||
Looking for a new eBook app? Check out these four solid, open source
|
||||
eBook readers for Android.
|
||||
![Computer browser with books on the screen][1]
|
||||
|
||||
Who doesn't like a good read? Instead of frittering away your time on social media or a [messaging app][2], you can enjoy a book, magazine, or another document on your Android-powered phone or tablet.
|
||||
|
||||
To do that, all you need is the right eBook reader app. So let's take a look at four solid, open source eBook readers for Android.
|
||||
|
||||
### Book Reader
|
||||
|
||||
Let's start off with my favorite open source Android eBook reader: [Book Reader][3]. It's based on the older, open source version of the now-proprietary FBReader app. Like earlier versions of its progenitor, Book Reader is simple and minimal, but it does a great job.
|
||||
|
||||
**Pros of Book Reader:**
|
||||
|
||||
* It's easy to use.
|
||||
* The app's interface follows Android's [Material Design guidelines][4], so it's very clean.
|
||||
* You can add bookmarks to an eBook and share text with other apps on your device.
|
||||
* There's growing support for languages other than English.
|
||||
|
||||
|
||||
|
||||
**Cons of Book Reader:**
|
||||
|
||||
* Book Reader has a limited number of configuration options.
|
||||
* There's no built-in dictionary or support for an external dictionary.
|
||||
|
||||
|
||||
|
||||
**Supported eBook formats:**
|
||||
|
||||
Book Reader supports EPUB, .mobi, PDF, [DjVu][5], HTML, plain text, Word documents, RTF, and [FictionBook][6].
|
||||
|
||||
![Book Reader Android app][7]
|
||||
|
||||
Book Reader's source code is licensed under the GNU General Public License version 3.0, and you can find it on [GitLab][8].
|
||||
|
||||
### Cool Reader
|
||||
|
||||
[Cool Reader][9] is a zippy and easy-to-use eBook app. While I think the app's icons are reminiscent of those found in Windows Vista, Cool Reader does have several useful features.
|
||||
|
||||
**Pros of Cool Reader:**
|
||||
|
||||
* It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors.
|
||||
* You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters.
|
||||
* It automatically scans your device for new books when you start it up. You can also access books on [Project Gutenberg][10] and the [Internet Archive][11].
|
||||
|
||||
|
||||
|
||||
**Cons of Cool Reader:**
|
||||
|
||||
* Cool Reader doesn't have the cleanest or most modern interface.
|
||||
* While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use.
|
||||
* The app's default dictionary is proprietary, although you can swap it out for [an open one][12].
|
||||
|
||||
|
||||
|
||||
**Supported eBook formats:**
|
||||
|
||||
You can use Cool Reader to browse EPUB, FictionBook, plain text, RTF, HTML, [Compiled HTML Help][13] (.chm), and TCR (the eBook format for the Psion series of handheld computers) files.
|
||||
|
||||
![Cool Reader Android app][14]
|
||||
|
||||
Cool Reader's source code is licensed under the GNU General Public License version 2, and you can find it on [Sourceforge][15].
|
||||
|
||||
### KOReader
|
||||
|
||||
[KOReader][16] was originally created for [E Ink][17] eBook readers but found its way to Android. While testing it, I found KOReader to be both useful and frustrating in equal measures. It's definitely not a bad app, but it's not my first choice.
|
||||
|
||||
**Pros of KOReader:**
|
||||
|
||||
* It's highly configurable.
|
||||
* It supports multiple languages.
|
||||
* It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet).
|
||||
|
||||
|
||||
|
||||
**Cons of KOReader:**
|
||||
|
||||
* You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book.
|
||||
* The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel.
|
||||
|
||||
|
||||
|
||||
**Supported eBook formats:**
|
||||
|
||||
You can view PDF, DjVu, CBT, and [CBZ][5] eBooks. It also supports EPUB, FictionBook, .mobi, Word documents, text files, and [Compiled HTML Help][13] (.chm) files.
|
||||
|
||||
![KOReader Android app][19]
|
||||
|
||||
KOReader's source code is licensed under the GNU Affero General Public License version 3.0, and you can find it on [GitHub][20].
|
||||
|
||||
### Booky McBookface
|
||||
|
||||
Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well.
|
||||
|
||||
**Pros of Booky McBookface:**
|
||||
|
||||
* There are no frills. It's just you and your eBook.
|
||||
* The interface is simple and clean.
|
||||
* Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device.
|
||||
|
||||
|
||||
|
||||
**Cons of Booky McBookface:**
|
||||
|
||||
* The app has few configuration options—you can change the size of the font and the brightness, and that's about it.
|
||||
* You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work.
|
||||
* You can't add bookmarks to an eBook.
|
||||
|
||||
|
||||
|
||||
**Supported eBook formats:**
|
||||
|
||||
You can read eBooks in EPUB, HTML, or plain text formats with Booky McBookface.
|
||||
|
||||
![Booky McBookface Android app][22]
|
||||
|
||||
Booky McBookface's source code is available under the GNU General Public License version 3.0, and you can find it [on GitHub][23].
|
||||
|
||||
Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment.
|
||||
|
||||
Have you ever downloaded an Android app only to find that it wants access to all your phone's...
|
||||
|
||||
There is a rich and growing ecosystem of open source applications for mobile devices, just like the...
|
||||
|
||||
With these seven open source apps, you can play chess against your phone or an online opponent,...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/10/open-source-ereaders-android
|
||||
|
||||
作者:[Scott Nesbitt][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/scottnesbitt
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen)
|
||||
[2]: https://opensource.com/article/19/3/open-messenger-client
|
||||
[3]: https://f-droid.org/en/packages/com.github.axet.bookreader/
|
||||
[4]: https://material.io/design/
|
||||
[5]: https://opensource.com/article/19/3/comic-book-archive-djvu
|
||||
[6]: https://en.wikipedia.org/wiki/FictionBook
|
||||
[7]: https://opensource.com/sites/default/files/uploads/book_reader-book-list.png (Book Reader Android app)
|
||||
[8]: https://gitlab.com/axet/android-book-reader/tree/HEAD
|
||||
[9]: https://f-droid.org/en/packages/org.coolreader/
|
||||
[10]: https://www.gutenberg.org/
|
||||
[11]: https://archive.org
|
||||
[12]: http://aarddict.org/
|
||||
[13]: https://fileinfo.com/extension/chm
|
||||
[14]: https://opensource.com/sites/default/files/uploads/cool_reader-icons.png (Cool Reader Android app)
|
||||
[15]: https://sourceforge.net/projects/crengine/
|
||||
[16]: https://f-droid.org/en/packages/org.koreader.launcher/
|
||||
[17]: https://en.wikipedia.org/wiki/E_Ink
|
||||
[18]: https://github.com/koreader/koreader/wiki/Dictionary-support
|
||||
[19]: https://opensource.com/sites/default/files/uploads/koreader-lookup.png (KOReader Android app)
|
||||
[20]: https://github.com/koreader/koreader
|
||||
[21]: https://f-droid.org/en/packages/com.quaap.bookymcbookface/
|
||||
[22]: https://opensource.com/sites/default/files/uploads/booky_mcbookface-menu.png (Booky McBookface Android app)
|
||||
[23]: https://github.com/quaap/BookyMcBookface
|
@ -0,0 +1,174 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (chenmu-kk)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 open source eBook readers for Android)
|
||||
[#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android)
|
||||
[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt)
|
||||
|
||||
四款安卓开源电子书阅读器
|
||||
======
|
||||
你在寻找新的电子书阅读软件吗?来看看这四个适用于安卓的可靠开源电子书阅读器吧。
|
||||
![Computer browser with books on the screen][1]
|
||||
|
||||
谁不想有一个好的阅读体验?你可以在自己安卓手机或平板上阅读一本书、杂志或其他文本,而非将时间浪费在社交媒体或[即时消息软件][2]上。
|
||||
|
||||
要做到这一点,你需要的是一个适合的电子书阅读软件。接下来让我们来看一看四款可靠、开源的安卓电子书阅读器。
|
||||
|
||||
### Book Reader
|
||||
|
||||
那我们先从我最喜欢的一款开源安卓电子书阅读器开始:[Book Reader][3]。它基于现在已有专利的FBReader应用的开源老版本。像FBReader的早期版本一样,Book Reader小而简单,但是好用。
|
||||
|
||||
**优点:**
|
||||
|
||||
|
||||
* 易于操作。
|
||||
* 该应用界面遵循安卓的 [Material Design 指南][4],因此非常干净。
|
||||
* 你可以为电子书添加书签,并将文本分享至你设备上的其他应用。
|
||||
* 不断提供除英语外的其他语言的支持
|
||||
|
||||
|
||||
|
||||
**缺点**
|
||||
|
||||
* Book Reader的自定义选项较少
|
||||
* 没有内置词典或支持外部词典的功能
|
||||
|
||||
|
||||
|
||||
**支持的电子书格式:**
|
||||
|
||||
Book Reader支持EPUB、 .mobi、PDF、[DjVu][5]、HTML、纯文本、 Word文本、RTF和[FictionBook][6]。
|
||||
|
||||
![Book Reader Android app][7]
|
||||
|
||||
Book Reader的源码已获得GNU通用公共许可证版本3.0的许可,你可以在[GitLab][8]中找到它。
|
||||
|
||||
### Cool Reader
|
||||
|
||||
[Cool Reader][9]是一个灵活易用的电子书软件。虽然我觉得该软件的图标会让想起Windows vista中的图标,但它确实有一些好用的功能。
|
||||
|
||||
**优点**
|
||||
|
||||
* 高度自定义,你可以更改字体、行宽、段间距、连字符、字体大小、页边距以及背景色。
|
||||
* 你可以覆盖书中的样式表。我发现这对于两三本书将所有文本设置为大小写字母很有用。
|
||||
* 它会在设备启动时自动搜寻设备中的新书资源。你也可以查阅有关[Gutenberg计划][10] 和 [互联网档案馆][11]中的书籍。
|
||||
|
||||
|
||||
|
||||
**优点**
|
||||
|
||||
* Cool Reader没有极简或者说最现代化的界面。
|
||||
* 虽然它开箱即用,但实际上你需要调整一些配置来更舒适地使用Cool Reader。
|
||||
* 应用的默认词典是专有的,尽管你可以用[开源的词典][12]来替换掉它。
|
||||
|
||||
|
||||
|
||||
**支持的电子书格式:**
|
||||
|
||||
你可以使用Cool Reader来浏览EPUB、小说、纯文本、RTF、HTML、[Compiled HTML Help][13] (.chm)和TCR (Psion系列掌上电脑的电子书格式)文件。
|
||||
|
||||
![Cool Reader Android app][14]
|
||||
|
||||
Cool Reader的源码已获得GNU通用公共许可证版本2的许可,你可以在[Sourceforge][15]中找到它。
|
||||
|
||||
### KOReader
|
||||
|
||||
[KOReader][16]最初是为了[E Ink][17] 电子书阅读器创建的,但后来发现它可用于安卓。 在测试它时,我发现KOReader在同等程度下既有用又令人沮丧。很明显它绝不是一款不好的应用,但不会是我的首选。
|
||||
|
||||
**优点**
|
||||
|
||||
* 高度自定义
|
||||
* 支持多种语言
|
||||
* 它允许你使用[词典][18](若你已安装)或者Wikipedia(若你已连接至网络)来查单词
|
||||
|
||||
|
||||
|
||||
**缺点**
|
||||
|
||||
* 每一本书你都需要改变设置。在你打开一本新书时,KOReader不会保存相关设置
|
||||
* 它的界面会让人觉得是一款专用电子书阅读器。该应用没有安卓的外形和感受。
|
||||
|
||||
|
||||
|
||||
**支持的电子书格式:**
|
||||
|
||||
你可以查阅PDF、DjVu、CBT、以及[CBZ][5]电子书。它也支持EPUB、小说、.mobi、Word文档、文本文件和[Compiled HTML Help][13] (.chm)文件。
|
||||
|
||||
![KOReader Android app][19]
|
||||
|
||||
Cool Reader的源码已获得GNU Affero通用公共许可证版本3.0的许可,你可以在[GitHub][20]上找到它。
|
||||
|
||||
### Booky McBookface
|
||||
|
||||
是的,那真的是[这个电子书阅读器][21]的名字。它是这篇文章中最基础的电子书阅读器,但不要让它(或者说这个傻乎乎的名字)使你失望。Booky McBookface易于使用并且有一件事它做的很好。
|
||||
|
||||
**优点**
|
||||
|
||||
* 没有多余的装饰。只有你和你的电子书。
|
||||
* 界面简洁。
|
||||
* 在安卓启动栏中的长按软件图标会弹出一个菜单,你可以从中打开正在阅读的最后一本书、获得所有未读书单列表、或者查找并打开设备上的一本书。
|
||||
|
||||
|
||||
|
||||
**优点**
|
||||
|
||||
* 软件中几乎没有配置选项——你可以更改字体大小和亮度,仅此而已。
|
||||
* 你需要使用屏幕底部的按钮浏览电子书。点击屏幕边缘无法操作。
|
||||
* 无法为电子书添加书签。
|
||||
|
||||
|
||||
|
||||
**优点**
|
||||
|
||||
你可以使用该软件阅读EPUB格式、HTML文本,或纯文本格式的电子书
|
||||
|
||||
![Booky McBookface Android app][22]
|
||||
|
||||
Booky McBookface的源码在GNU通用公共许可证版本3.0下可用,你可以在[GitHub][23]中找到它。
|
||||
|
||||
你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧。
|
||||
|
||||
Have you ever downloaded an Android app only to find that it wants access to all your phone's...
|
||||
|
||||
There is a rich and growing ecosystem of open source applications for mobile devices, just like the...
|
||||
|
||||
With these seven open source apps, you can play chess against your phone or an online opponent,...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/10/open-source-ereaders-android
|
||||
|
||||
作者:[Scott Nesbitt][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[chenmu-kk](https://github.com/chenmu-kk)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/scottnesbitt
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen)
|
||||
[2]: https://opensource.com/article/19/3/open-messenger-client
|
||||
[3]: https://f-droid.org/en/packages/com.github.axet.bookreader/
|
||||
[4]: https://material.io/design/
|
||||
[5]: https://opensource.com/article/19/3/comic-book-archive-djvu
|
||||
[6]: https://en.wikipedia.org/wiki/FictionBook
|
||||
[7]: https://opensource.com/sites/default/files/uploads/book_reader-book-list.png (Book Reader Android app)
|
||||
[8]: https://gitlab.com/axet/android-book-reader/tree/HEAD
|
||||
[9]: https://f-droid.org/en/packages/org.coolreader/
|
||||
[10]: https://www.gutenberg.org/
|
||||
[11]: https://archive.org
|
||||
[12]: http://aarddict.org/
|
||||
[13]: https://fileinfo.com/extension/chm
|
||||
[14]: https://opensource.com/sites/default/files/uploads/cool_reader-icons.png (Cool Reader Android app)
|
||||
[15]: https://sourceforge.net/projects/crengine/
|
||||
[16]: https://f-droid.org/en/packages/org.koreader.launcher/
|
||||
[17]: https://en.wikipedia.org/wiki/E_Ink
|
||||
[18]: https://github.com/koreader/koreader/wiki/Dictionary-support
|
||||
[19]: https://opensource.com/sites/default/files/uploads/koreader-lookup.png (KOReader Android app)
|
||||
[20]: https://github.com/koreader/koreader
|
||||
[21]: https://f-droid.org/en/packages/com.quaap.bookymcbookface/
|
||||
[22]: https://opensource.com/sites/default/files/uploads/booky_mcbookface-menu.png (Booky McBookface Android app)
|
||||
[23]: https://github.com/quaap/BookyMcBookface
|
Loading…
Reference in New Issue
Block a user