Search code examples
mysqlmariadbdump

mysql dump in maria db lost data


I imported mysql dump into maria db, and lost serialized data. Is this possible? could it be the import process or something else is at miss?

Besides having maria db and mysql, I also do search and replace on db to change the domain of the site. Could this cause problem with serialised data?

a:7:{s:15:"homepage_slider";a:1:{i:0;a:3:{s:10:"slide_text";s:30:"Think big. Act with knowledge.";s:10:"slide_link";a:1:{i:0;s:2:"22";}s:11:"slide_image";a:2:{s:13:"attachment_id";s:3:"132";s:3:"url";s:45:"//act.dev/app/uploads/2016/01/index_slide.png";}}}s:17:"homepage_triplets";a:3:{i:0;s:2:"22";i:1;s:2:"20";i:2;s:3:"113";}s:15:"social_networks";a:4:{i:0;a:2:{s:12:"network_name";s:8:"facebook";s:11:"network_url";s:31:"http://www.facebook.com/ACT.GE/";}i:1;a:2:{s:12:"network_name";s:8:"linkedin";s:11:"network_url";s:8:"http://2";}i:2;a:2:{s:12:"network_name";s:7:"twitter";s:11:"network_url";s:12:"http://asdas";}i:3;a:2:{s:12:"network_name";s:7:"youtube";s:11:"network_url";s:7:"http://";}}s:13:"office_on_map";a:8:{s:8:"location";s:38:"Sairme Hill, Tbilisi, Tbilisi, Georgia";s:5:"venue";s:14:"51 Sairme Hill";s:7:"address";s:11:"Sairme Hill";s:4:"city";s:7:"Tbilisi";s:5:"state";s:7:"Tbilisi";s:7:"country";s:7:"Georgia";s:3:"zip";s:4:"0194";s:11:"coordinates";a:2:{s:3:"lat";i:0;s:3:"lng";i:0;}}s:12:"office_email";s:14:"[email protected]";s:11:"office_tell";s:17:"+995 32 2422 322 ";s:14:"office_virtual";b:0;}

enter image description here


Solution

  • PHP serialized object contains string lengths along with the actual string values. So if you are modifying it with an external tool you need to make sure to change the string lengths when you are changing string values. The length of the string goes after s:.