[root@dwh1 ~]# su - mysql
-bash-4.1$ ps -ef | grep mysql
root 6643 6620 0 00:25 pts/6 00:00:00 su - mysql
mysql 6644 6643 0 00:25 pts/6 00:00:00 -bash
mysql 6665 6644 4 00:25 pts/6 00:00:00 ps -ef
mysql 6666 6644 0 00:25 pts/6 00:00:00 grep mysql
mysql 44296 1 0 Apr15 ? 00:00:00 /bin/sh /usr/local/mysql5.6/bin/mysqld_safe --datadir=/usr/local/mysql5.6/data --pid-file=/usr/local/mysql5.6/data/dwh1.pid
mysql 44409 44296 0 Apr15 ? 00:00:11 /usr/local/mysql5.6/bin/mysqld --basedir=/usr/local/mysql5.6 --datadir=/usr/local/mysql5.6/data --plugin-dir=/usr/local/mysql5.6/lib/plugin --log-error=/usr/local/mysql5.6/data/dwh1.err --pid-file=/usr/local/mysql5.6/data/dwh1.pid
[root@dwh1 ~]# mkdir /mysql
[root@dwh1 ~]# chown -R mysql:mysql /mysql
[root@dwh1 ~]# su - mysql
-bash-4.1$ cd /usr/local/mysql5.6/
-bash-4.1$ ls
COPYING INSTALL-BINARY README bin data docs include lib man my.cnf mysql-test scripts share sql-bench support-files
-bash-4.1$ mv data /mysql/
/usr/local/mysql5.6/bin/mysqld_safe --datadir=/mysql/data
修改/etc/my.cnf
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
datadir=/mysql/data
[root@dwh1 data]# /etc/init.d/mysql start
Starting MySQL [确定]
[root@dwh1 data]# ps -ef | grep mysqld
root 8237 1 1 00:35 pts/0 00:00:00 /bin/sh /usr/local/mysql5.6/bin/mysqld_safe --datadir=/mysql/data --pid-file=/mysql/data/dwh1.pid
mysql 8368 8237 61 00:35 pts/0 00:00:01 /usr/local/mysql5.6/bin/mysqld --basedir=/usr/local/mysql5.6 --datadir=/mysql/data --plugin-dir=/usr/local/mysql5.6/lib/plugin --user=mysql --log-error=/mysql/data/dwh1.err --pid-file=/mysql/data/dwh1.pid
root 8393 6415 0 00:35 pts/0 00:00:00 grep mysqld