FreeBSD安装MySQL

64 阅读1分钟

使用的系统版本

root@freebsd14_node1:~ # uname -a
FreeBSD freebsd14_node1 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC amd64

在pkg包仓库搜索MySQL

我们可以在pkg仓库搜索MySQL,然后根据搜索结果安装自己需要的版本。

pkg search mysql

image.png

安装mysql

下面命令安装MySQL Server的时候会将client一起安装上去

pkg install mysql91-server-9.1.0_1

启动MySQL

root@freebsd14_node1:~ # service mysql-server enable
mysql enabled in /etc/rc.conf
root@freebsd14_node1:~ # service mysql-server start
Starting mysql.

测试

默认无密码,输入mysql即可进入。

root@freebsd14_node1:~ # mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 9.1.0 Source distribution

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>

参考资料