arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Corrected - refer last post] Migrate Your Website to New VPS Host ( Ubuntu/Debian )
#14
@Rehan

(08-22-2019, 08:47 AM)Rehan Wrote: Database Export via Terminal

mysqldump -u [username] -p [database name] > [database name].sql
It's always wise to use the host and port flags to explicitly set the server we're communicating with; the above command assumes a lot of things that aren't always correct. In addition to that, it's always a good idea to also explicitly mention the default-character-set to be used in that backup process (to avoid ending up with garbage text in the database. Bellow I used UTF-8, but you should use the one that you're database is using.

Taking into account the above remarks, the command should be something like:
mysqldump  --opt -u [username] -p --host=DB_SERVER_IP --port=DB_SERVER_PORT --default-character-set=utf8 --databases DB1_NAME DB2_NAME etc.. > ~/random_path/db_dump.sql

(08-22-2019, 08:47 AM)Rehan Wrote: (...........)
CREATE DATABASE newdb;
(...)
Use the following command to restore the database

mysqldump -u [username] -p [database name] < [database name].sql

Database restore is completed now (..................)
That's WRONG!.. To restore A MySQL data_dump we use the 'mysql' commandline utility NOT mysqldump, like so:

mysql -u [username] -p --host DB_SERVER_IP --port DB_SERVER_PORT --default-character-set=utf8 --one-database DB1_NAME < ~/random_path/db_dump.sql

mysql -u [username] -p --host DB_SERVER_IP --port DB_SERVER_PORT --default-character-set=utf8 --one-database DB2_NAME < ~/random_path/db_dump.sql

etc......................

That's the way to do it!..
VirMach's Buffalo_VPS-9 Holder (Dec. 20 - July 21)
microLXC's Container Holder (july 20 - ?)
VirMach's Phoenix_VPS-9 Holder (Apr. 20 - June 20)
NanoKVM's NAT-VPS Holder (jan. 20 - ?)


Messages In This Thread
RE: Migrate Your Website to New VPS Host ( Ubuntu/Debian ) - by fChk - 12-26-2020, 09:53 AM


person_pin_circle Users browsing this thread: 3 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting