1

I dropped the sys schema while tinkering around mysql 8(current version). Is there a way to recover it. I am using ubuntu 20.04. I tried using the mysql documentation but I couldn't find anything relevant. Could someone with better experience help me with this? Thank you.

5
  • 1
    This question has nothing to do with programming, therefore it is off topic here on SO. The DBA sister site of SO offers help on database admin questions like this one.
    – Shadow
    Feb 4, 2021 at 19:16
  • SQL for those is here however I hope someone can offer a better recommendation. If you have another server you could take a mysqldump of the sys schema and import that into your current version.
    – danblack
    Feb 5, 2021 at 2:24
  • Is there a way to recover it. If you have no complete schema backup then noway.
    – Akina
    Feb 5, 2021 at 4:44
  • 1
    sys schema is just inbuilt views.
    – danblack
    Feb 5, 2021 at 6:19
  • I saw an available sys schema on github but it is meant for 5.6 or 5.7. can I get for mysql 8.0? Feb 5, 2021 at 8:03

1 Answer 1

2
  1. Go to the folder of the github repo.

  2. Download the sys_schema folder using gitzip or any other available extensions. I personally used gitzip. Needless to say you can download the whole mysql-server repo but that would be inefficient as you do not need everything and it has a heavy download size.

  3. Extract it to a folder and cd into it

  4. Log in to the mysql client

    mysql -u root -p
    
  5. Import the sys_57.sql file. Don't mind the name, it is compatible with mysql 8. using

    source ./sys_57.sql
    

There you go, you have your sys schema back. Thanks to danblack for giving me a cue.

P.S akina this is computer, there is always a way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.