@Boryl the best approach is probably to use
mysqldump to get a text file of your entire database contents, open it in a text editor to use find+replace, then re-import the sql file.
Note that Ghost prior to 4.0 stored URLs in the database as relative so there shouldn’t be any need to replace URLs if your domain has changed but there may be some cleanup needed if you’re changing subdirectories. In Ghost 4.0 onwards urls are stored as
__GHOST_URL__/* in the database for faster transforms, those urls are always relative to your configured url so there should be less need (hopefully no need) for manual find+replace when changing subdirectory.