See this thread - Reset media library and others, search for ‘reset library’
Via SSH -
systemctl stop mediacenter
rm ~/.kodi/userdata/Database/MyVideos116.db
rm ~/.kodi/userdata/Database/MyMusic72.db
rm ~/.kodi/userdata/Database/Textures13.db
rm -r ~/.kodi/userdata/Thumbnails/
systemctl start mediacenter
That should remove your libraries and leave everything else intact.
Once you do this you will have to SETUP YOUR SOURCES AGAIN just as you would from a clean install.
Edit sources.xml to remove original sources or use a context menu (3 horizontal bars on remove) to remove sources
Add them back again with media>library>manage sources taking care to navigate to root folder/mnt points