Changing or symlink database directory caused 500 error

I need to move mysql directory to other directory.
I try

  1. symlink ln -s /home/mysql /var/lib/mysql
  2. change database location in mysql config file

Database server starts fine, but when I try to login into panel I got

Server Error (500)

What is wrong?

never do symlink, does the /home and /var under different partitions?

the best method is to change the datadir instead
that means

stop the mysql and move /var/lib/mysql to /home

and edit the my.cnf and add the entry like


after that restart mysql, all will be good then