After I installed the NVIDIA graphics card driver, when I opened a GUI program on my Ubuntu18.4 again, it showed the following error:
Invalid MIT-MAGIC-COOKIE-1 key
You can use the following command to solve:
export DISPLAY=:1.0
If you don't want to manually execute the program every time before running the GUI program, you can add it to the .bashrc file