
最近,我的伺服器崩潰了。託管公司已在替換驅動器上安裝了新的 CentOS,並將舊驅動器連接到我的伺服器。我已在新伺服器上安裝並設定了 cPanel,並建立了類似的使用者帳戶等,就像我的舊伺服器一樣。
傳輸 public_html 很容易,因為它涉及資料的複製貼上。我想知道應該如何將資料從舊的 SQL 安裝移至新伺服器。
有什麼幫助嗎?
答案1
我假設資料庫伺服器是 mysql,之前的作業系統是 centos,並且您只想將資料庫移至新磁碟
我在 StackExchange 論壇之一找到了這個答案。你嘗試過這個方法嗎?
https://dba.stackexchange.com/questions/174/how-can-i-move-a-database-from-one-server-to-another
舊伺服器
Stop mysql server
Copy contents of datadir to another location on disk (~/mysqldata/*)
Start mysql server again (downtime was 10-15 minutes)
compress the data (tar -czvf mysqldata.tar.gz ~/mysqldata)
copy the compressed file to new server
新伺服器
install mysql (don't start)
unzip compressed file (tar -xzvf mysqldata.tar.gz)
move contents of mysqldata to the datadir
Make sure your innodb_log_file_size is same on new server, or if it's not, don't copy the old log files (mysql will generate these)
Start mysql