MySQL 服务器存储图像

MySQL Server storing images

我需要一个服务器,我可以用 python 访问它并且可以存储很多图片。我读到 MySQL-Server 可以工作。首先,这是最好的选择还是其他更好的选择? (我想用图像训练人工智能)
现在我构建了一些 python 代码,可以将图像保存在我的 MySQL-Server 中,但它们太大了。在我的硬盘上,他们需要 4KB,在 MySQL-Server 中,两者一起需要 160KB,所以每个图像需要 80KB。
那是存储空间的 20 倍!!有没有更好的存储方式?
我的代码在 python:

def insert_image(self, photo_path, name, table_name, id):
    binary_photo = self.convert_to_binary_data(photo_path)
    insert_blob_query = "INSERT INTO {} (id, name, photo) VALUES ('{}','{}',{})".format(table_name, id, name,
                                                                                        str(base64.b64encode(
                                                                                            binary_photo))[1:])
    self.connection.execute(insert_blob_query)

def read_blob_data_by_id(self, id, table_name, path):
    sql_fetch_blob_query = "SELECT * from {} where id = '{}'".format(table_name, id)
    result = self.connection.execute(sql_fetch_blob_query)
    for row in result:
        id_query = row[0]
        name = row[1]
        photo = base64.b64decode(row[2])
    file_like = io.BytesIO(photo)
    img = Image.open(file_like)
    img.save(path + '\' + name + '.jpg')

我正在使用 python 3.8 和一个 MySQL-Server 8.2。

您可以将图像存储在其他位置,例如您的计算机或网络服务器(如果是网站),同时将它们的链接存储在数据库中。