补写: mysql
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
能够直接经过server启动 sql
通常我喜欢给data分区给很大,因此但愿可以吧数据存放在data下 shell
建文件夹mysql 数据库
#mkdir /data/mysql server
将/usr/local/mysql/data目录下文件复制进/data/mysql 进程
在/usr/local/mysql下建目录var ip
建连接 it
#ln -s /data/mysql var io
更改/etc/init.d/mysql.server,将datadir路径改成/usr/local/mysql/var file
直接server mysql.server start启动,查看进程,能够看到datadir已经更改成/usr/local/mysql/var
若经过mysqld_safe,没有用参数启动,datadir路径依然为/usr/local/mysql/data
进去更改mysqld_safe的默认参数
更改/etc/my.cnf
再利用mysqld_safe启动,数据库存放路径更改成/usr/local/mysql/var