Ubuntu环境下搭建数据库服务器,可选择MySQL或PostgreSQL,以下是具体步骤:
sudo apt update && sudo apt upgrade -ysudo apt install mysql-server -ysudo systemctl start mysql,sudo systemctl enable mysqlsudo mysql_secure_installation,按提示设置root密码等sudo mysql -u root -p,输入密码登录/etc/mysql/mysql.conf.d/mysqld.cnf,将bind-address改为0.0.0.0,并重启服务sudo apt update && sudo apt upgrade -ysudo apt install postgresql postgresql-contrib -ysudo systemctl start postgresql,sudo systemctl enable postgresqlpostgres用户,使用psql命令创建数据库和用户/etc/postgresql/<version>/main/postgresql.conf和pg_hba.conf,修改相关配置并重启服务