补写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启动

一般我喜欢给data分区给很大,所以希望能够吧数据存放在data下

建文件夹mysql

#mkdir /data/mysql

将/usr/local/mysql/data目录下文件复制进/data/mysql

在/usr/local/mysql下建目录var

建链接

#ln -s /data/mysql var

更改/etc/init.d/mysql.server,将datadir路径改为/usr/local/mysql/var

直接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

你可能感兴趣的:(补写mysql安装)