DDraceNetwork服務(wù)器使用mysql
由于ddnet官網(wǎng)發(fā)布的release版本是不帶mysql的,所以需要自己編譯支持mysql的ddnet-server
使用debian11系統(tǒng)示例,
更新軟件包
apt update && apt upgrade
安裝依賴
apt install build-essential cargo cmake git glslang-tools google-mock libavcodec-extra libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libcurl4-openssl-dev libfreetype6-dev libglew-dev libnotify-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libsdl2-dev libsqlite3-dev libssl-dev libvulkan-dev libwavpack-dev libx264-dev python rustc spirv-tools -y
apt install libmariadbclient-dev -y
安裝mariadb
apt install mariadb-server
設(shè)置root密碼
mysql_secure_installation
systemctl start mariadb
編譯DDnet-server
git clone --shallow-exclude=included-libs https://ghproxy.com/https://github.com/ddnet/ddnet
mkdir build
cd build
cmake .. -DMYSQL=ON
make -j$(nproc)
創(chuàng)建數(shù)據(jù)庫和用戶
create database ddnet;
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
flush privileges;
允許遠(yuǎn)程連接
grant all privileges on *.* to ddnet@"%" identified by "thebestpassword" with grant option;
flush privileges;
修改/etc/mysql/mariadb.conf.d/50-server.cnf的bind-address = 127.0.0.1
為bind-address = 0.0.0.0
systemctl restart mariadb
修改服務(wù)器配置文件
sv_use_sql 1
add_sqlserver r ddnet record ddnet "thebestpassword" "localhost" "3306"
add_sqlserver w ddnet record ddnet "thebestpassword" "localhost" "3306"第一個ddnet為數(shù)據(jù)庫名,record為表前綴名,第二個ddnet為用戶名,thebestpassword為密碼,localhost為地址,3306為mysql端口