Modify
# cd/usr/local
# mkdir db (build MySQL database new storage directory)
# Cp-r/VAR/DB/MYSQL/VAR/DB/MYSQL_BK (back up the default MySQL database)
# cp-r/var/db/mysql/usr/local/db (copy MySQL database to new storage directory)
# mysqladmin shutdown (turn MySQL off)
# cd/var/db
# rm-r MySQL (delete the previous MySQL database, not an eyesore)
# ee/usr/local/etc/rc.d/mysql-server (Modify MySQL startup script)
Find this line:: ${mysql_dbdir= "/var/db/mysql"}
Change to:: ${mysql_dbdir= "/usr/local/db/mysql"}
# chown-r Mysql/usr/local/db/mysql (Modify some permissions)
# Chown-r Root/usr/local/db/mysql
# Chown-r Mysql:mysql/usr/local/db/mysql
# chmod 700/usr/local/db/mysql
# Reboot (Restart the machine)
Inspection
# MySQL
Mysql>create database A; (Building a data base)
mysql>quit;
#cd/usr/local/db/mysql
#ls
See/A This folder, it means success.
#rm-R A (yes, yes, delete it)
This article is from "This is My Freedom" blog, please be sure to keep this source http://sasyun.blog.51cto.com/8709212/1530829