相比重新安裝,省去了編譯的過程,同時還能保留以前的人物、裝備等。
注意,若不想重新編譯安裝,則需要創建一樣的目錄、賬戶等,以減少不必要的麻煩。
首先備份數據:
mysql備份和導入方法見:使用dump備份mysql數據庫-CSDN博客
備份文件
mysqldump -u trinity -ptrinity auth > auth.sqlmysqldump -u trinity -ptrinity world > world.sqlmysqldump -u trinity -ptrinity characters > characters.sql
備份的時候會有警告和報錯:'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation'? ,不用去管它。
將備份文件scp到服務器:
scp *.sql 192.168.1.12:/home/wow
準備導入數據庫。
數據庫導入
導入之前,需要導入一個“創建數據庫”的sql
只需要導入這一個,后面其它數據庫會自動導入
To create the MySQL databases needed by Trinity, you need to execute one of the following MySQL queries with your mysql client:
- For 3.3.x:
- TrinityCore/sql/create/create_mysql.sql at 3.3.5 · TrinityCore/TrinityCore · GitHub
或者到項目TrinityCore/sql/create目錄也能獲取該文件,該文件內容:
CREATE USER 'trinity'@'localhost' IDENTIFIED BY 'trinity' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;GRANT USAGE ON * . * TO 'trinity'@'localhost';CREATE DATABASE `world` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE `characters` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE DATABASE `auth` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;GRANT ALL PRIVILEGES ON `world` . * TO 'trinity'@'localhost' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON `characters` . * TO 'trinity'@'localhost' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON `auth` . * TO 'trinity'@'localhost' WITH GRANT OPTION;
下載之后,進入mysql,然后導入:
source? create_mysql.sql
這時候一套新的TrinityCore服務已經安裝好了。如果這時候執行下一步同步TrinityCore文件并啟動authserver和worldserver,就是全新環境。啟動之后再導入auth和characters兩個庫,理論上就能恢復當前游戲環境和賬戶等。但是因為加入了TrinityBot功能,所以world庫也需要進行相應修改。最終就是三個庫一起導入:
導入備份的三個文件:
sudo mysqluse auth;source auth.sqluse worldsource world.sqluse characterssource characters.sql
?
?同步TrinityCore文件
直接把server目錄全部cp到新機器的相同目錄:
scp -r server 192.168.1.12:/home/wow/scp -R server 192.168.1.12:/home/wow/
修改服務器地址
因為換了機器,所以要修改auth里面的address地址,修改成192.168.1.12
mysql> use auth;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> select id,name,address,localaddress,gamebuild from realmlist;
+----+---------+-----------------+--------------+-----------+
| id | name | address | localaddress | gamebuild |
+----+---------+-----------------+--------------+-----------+
| 1 | Trinity | 114.115.136.249 | 127.0.0.1 | 12340 |
+----+---------+-----------------+--------------+-----------+
1 row in set (0.01 sec)mysql> UPDATE realmlist SET address = '192.168.1.12' WHERE address = '114.115.136.249';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> select id,name,address,localaddress,gamebuild from realmlist;
+----+---------+--------------+--------------+-----------+
| id | name | address | localaddress | gamebuild |
+----+---------+--------------+--------------+-----------+
| 1 | Trinity | 192.168.1.12 | 127.0.0.1 | 12340 |
+----+---------+--------------+--------------+-----------+
1 row in set (0.00 sec)
下載官方源碼
啟動server/bin/worldserver 之后報錯:DBUpdater: The given source directory /home/wow/TrinityCore does not exist 。原來還是需要官方的源碼,并要放在以前編譯的時候的目錄位置。也就是wow賬戶的TrinityCore目錄。另外現在git clone默認拉下來的是wow最新版,我們采用的是3.3.5版本,這樣git clone需要帶上-b 3.3.5參數
git clone --depth 1 -b 3.3.5 https://github.com/TrinityCore/TrinityCore
好了,到了這里,服務器就完全鏡像過來了!新的一臺服務器就裝好了。
這時候先執行server/bin/authserver ,然后再執行server/bin/worldserver ,整個服務就起來了!
?調試
啟動worldserver報錯
Updating Auth database...
DBUpdater: The given source directory /home/wow/TrinityCore does not exist, change the path to the directory where your sql directory exists (for example c:\source\trinitycore). Shutting down.
Could not update the Login database, see log for details.
下載官方源碼:
git clone --depth 1 https://github.com/TrinityCore/TrinityCore
啟動worldserver 報錯ERROR 1054 (42S22) at line 2 in file:
>> The file '2020_12_15_00_characters.sql' was applied to the database, but is missing in your update directory now!
Cleanup is disabled! There were ?86 dirty files applied to your database, but they are now missing in your source directory!
>> Applied 1 query. Containing 1 new and 85 archived updates.
Updating World database...
DBUpdater: Given update include directory "/home/wow/TrinityCore/sql/old/3.3.5a/world" does not exist, skipped!
>> Applying update "2024_05_11_12_world.sql" '478F5B6'...
mysql: [Warning] Using a password on the command line interface can be insecure.
>> Reapplying update "2024_05_12_00_world.sql" 'D86B392' -> '1175592' (it changed)...
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1054 (42S22) at line 2 in file: '/home/wow/TrinityCore/sql/updates/world/master/2024_05_12_00_world.sql': Unknown column 'PhaseId' in 'field list'
Applying of file '/home/wow/TrinityCore/sql/updates/world/master/2024_05_12_00_world.sql' to database 'world' failed! If you are a user, please pull the latest revision from the repository. Also make sure you have not applied any of the databases with your sql client. You cannot use auto-update system and import sql files from TrinityCore repository with your sql client. If you are a developer, please fix your sql query.
Could not update the World database, see log for details.
看了下:master = 10.2.7.55165, 3.3.5 = 3.3.5a.12340, wotlk_classic = 3.4.3.54261, cata classic = 4.4.0.55141
原來這是分支沒弄對。
切換到3.3.5分支:
git checkout 3.3.5
沒切成,重新git clone
git clone --depth 1 -b 3.3.5 https://github.com/TrinityCore/TrinityCore
發現延時異常大
演示472ms,這也太大了,怎么回事呢 ? 有的號延時1ms,真是弄不懂了...