1.ubuntu下解压到/usr/local/mysql
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown -r mysql .
chgrp -r mysql .
chown -r root .
chown -r mysql data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
2.修改my.cnf
nano /etc/my.cnf
添加
basedir=/usr/local/mysql
datadir=/home/mysql
3.初始化数据库
scripts/mysql_install_db --user=mysql
4.启动
bin/mysqld_safe --user=mysql &
修改密码
mysql>use mysql
mysql>update user set password=password('root') where user='root';
mysql>flush privileges;
mysql>exit
5.设置自动启动
apt-get install chkconfig
chkconfig --add mysqld
chkconfig mysqld on
6.将mysql加入到path
nano /etc/profile
umask前加进这句
export path=$path:/usr/local/mysql/bin
7.重启系统
reboot