安装体验MySQL 9.1 (Docker 安装)

Docker 安装非常简单,几乎一分钟内即可完成安装。

Docker 安装 MySQL 9.1

安装镜像:

docker pull container-registry.oracle.com/mysql/community-server:9.1

启动镜像:

docker run --name=mysql91  --restart on-failure -d container-registry.oracle.com/mysql/community-server:9.1

查看初始安装时 root 账号密码:

docker logs mysql91 2>&1 | grep GENERATED

登录安装的数据库:

docker exec -it mysql91 mysql -uroot -p

好了。这就完成安装了:

# docker exec -it mysql91 mysql -uroot -p
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 9.1.0

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>

修改 root 密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'YOUR-NEW-PASSWORD';

详细的步骤与说明可以参考:Basic Steps for MySQL Server Deployment with Docker

其他的 Docker 相关管理命令

docker start    mysql91 # 启动
docker stop     mysql91 # 关闭
docker restart  mysql91 # 重启

docker rm       mysql91  # 删除容器

体验 MySQL 9.0/9.1 系列

创建数据库:

mysql> create database orczhou;
Query OK, 1 row affected (0.00 sec)

mysql> use orczhou
Database changed

创建一个表,可以用于存储向量,并进行简单的向量计算:

create table vector_t01 (
    id int,
    s_v_01 vector(390),
    s_v_02 vector(390)
);

mysql> create table vector_t01(id int,s_v_01 vector(390),s_v_02 vector(390));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into vector_t01 values (1,string_to_vector('[1,2,3]'),string_to_vector('[4,5,6]'));
Query OK, 1 row affected (0.00 sec)

mysql> select DISTANCE(s_v_01,s_v_02);
ERROR 1305 (42000): FUNCTION orczhou.DISTANCE does not exist

啥!FUNCTION DISTANCE does not exist

看看文档描述,我下巴掉了一地(参考):

Note

DISTANCE() is available only for users of HeatWave MySQL on OCI; it is not included in MySQL Commercial or Community distributions.

没有search就算了,好不容易有一个 DISTANCE,发现还是受限制的…

好了,那就体验到这里吧… 期待在后续的版本能够把搜索功能补齐。一定要体验的话,可以自己去Oracle Cloud进行测试。

参考链接

Leave a Reply

Your email address will not be published. Required fields are marked *