本文参照http://visionsky.blog.51cto.com/733317/827747/,在此向作者致谢!
- shell> sudo apt-get install libaio-dev(或者libaio1)
- shell> sudo groupadd mysql
- shell> sudo useradd -r -g mysql mysql
- shell> sudo cd /usr/local
- shell> tar zxvf /home/niumd/mysql-5.5.13-linux2.6-i686.tar.gz
- shell> sudo ln -s /usr/local/mysql-5.5.13-linux2.6-i686.tar.gz mysql
- shell> cd mysql
- shell> sudo chown -R mysql .
- shell> sudo chgrp -R mysql .
- shell> sudo scripts/mysql_install_db --user=mysql
- shell> sudo chown -R root .
- shell> sudo chown -R mysql data
- shell> sudo cp support-files/mysql.server /etc/init.d/mysql.server
- shell> sudo cp support-files/my-medium.cnf /etc/my.cnf
- shell> sudo bin/mysqld_safe --user=mysql & (这里回车后会停留,直接再按回车即可)
- shell> sudo pwd /usr/local/mysql
- shell> sudo bin/mysqladmin -u root password 'new-password'
- shell> sudo bin/mysql -uroot -p
至此安装完成!建议按下面的第二步操作:1、让mysql开机自己启动
- $ sudo update-rc.d -f mysql.server defaults
- $ sudo update-rc.d -f mysql.server remove
- $ sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
- $ mysql -u root -p