由于ubuntu通过apt-get安装mysql只能安装mysql5.1,为了更新的版本只能通过源码安装,去oracle官网下载 Linux-Generic 下的32位或64位,这个根据自己系统。
如果已经安装了mysql,必须先卸载,如果干净的卸载,mysql这里我就不提了
安装步骤:(安装步骤参考mysql官方安装文档 )
- 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
- $ 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
转载于:https://blog.51cto.com/visionsky/827747