Home >Database >Mysql Tutorial >How to install MySQL database in FreeBSD13
MySQL is an open source small relational database management system. MySQL is currently widely used in small and medium-sized websites on the Internet. Due to its small size, fast speed, low total cost of ownership, and especially the characteristics of open source, many small and medium-sized websites choose MySQL as their website database in order to reduce the total cost of website ownership.
##EnvironmentFreeBSD 13-RELEASEModify the pkg sourceYou need to create/usr/ first local/etc/pkg/repos directory, then create the FreeBSD.conf configuration file, close the default source, and then add the domestic software source.
root@freebsd:~ # mkdir -p /usr/local/etc/pkg/reposroot@freebsd:~ # vi /usr/local/etc/pkg/repos/FreeBSD.confFreeBSD: { enabled: no } ustc: { url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg//${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", enabled: yes }
Update pkg source:
root@freebsd:~ # pkg update -fUpdating ustc repository catalogue... Fetching meta.txz: 100% 916 B 0.9kB/s 00:01 Fetching packagesite.txz: 100% 6 MiB 6.5MB/s 00:01 Processing entries: 100% ustc repository update completed. 30371 packages processed. All repositories are up to date.Install MySQL databaseSearch the pkg source What versions of mysql are there:
root@freebsd:~ # pkg search "^mysql"
Install the mysql80 version below:
root@freebsd:~ # pkg install -y mysql80-server mysql80-clientRun MySQLNext you will run the following command, which will add the MySQL service to the
/etc/rc.conf configuration file and start mysql on boot.
root@freebsd:~ # sysrc mysql_enable=yesmysql_enable: -> yes
Start the mysql service:
root@freebsd:~ # service mysql-server startStarting mysql.View the service status and mysql listening port:
root@freebsd:~ # service mysql-server statusmysql is running as pid 2194. root@freebsd:~ # sockstat -4lUSER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS mysql mysqld 2194 19 tcp46 *:33060 *:* mysql mysqld 2194 24 tcp4 127.0.0.1:3306 *:* root sshd 802 4 tcp4 *:22 *:* root sendmail 781 3 tcp4 127.0.0.1:25 *:* root syslogd 709 7 udp4 *:514 *:*Verify installationTo verify the installation, you can log in as root and check the database version using the following command:
root@freebsd:~ # mysqladmin -u root -p versionEnter password: mysqladmin Ver 8.0.25 for FreeBSD13.0 on amd64 (Source distribution) Copyright (c) 2000, 2021, 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. Server version 8.0.25 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 4 min 16 sec Threads: 2 Questions: 6 Slow queries: 0 Opens: 138 Flush tables: 3 Open tables: 54 Queries per second avg: 0.023
The above is the detailed content of How to install MySQL database in FreeBSD13. For more information, please follow other related articles on the PHP Chinese website!