We have already installed Ubuntu 11.04. We found that apt-get can only install MySQL 5.1. If you want to use MySQL 5.5, you can only compile it by yourself.
The compilation and installation process records are as follows:
1. Go to mysql.com to download the source code of MySQL 5.5.15:
Mysql-5.5.15.tar.gz (Generic Linux (Architecture Independent ))
2. install necessary software:
1. cmake
~ $ Sudo apt-get install cmake
2. bison
~ $ Sudo apt-get install bison
3. Add user groups and user names to the MySQL server
~ $ Sudo groupadd mysql
~ $ Sudo useradd-r-g mysql
4. decompress the downloaded source code (in the download path ~ /Src for example), compile and install:
~ $ Cd src
~ /Src $ tar-xzf mysql-5.5.15.tar.gz
~ /Src $ cd mysql-5.5.15
~ /Src/mysql-5.5.15 $ cmake.
~ /Src/mysql-5.5.15 $ make
~ /Src/mysql-5.5.15 $ sudo make install
If no error is reported for the preceding commands, the compilation and installation are successful. The default value is/usr/local/mysql.
Run the following command to complete the installation:
~ /Src/mysql-5.5.15 $ cd/usr/local
/Usr/local $ sudo chown-R mysql. mysql
/Usr/local $ sudo ln-s/usr/local/mysql/bin/*/usr/bin
/Usr/local $ sudo ln-s/usr/local/mysql/share/usr/share/mysql
If you want to use MySQL for secondary development:
/Usr/local $ sudo ln-s/usr/local/mysql/include/usr/include/mysql
/Usr/local $ sudo ln-s/usr/local/mysql/lib/*/usr/lib/
Return to the initial path and run:
~ $ Mysql -- version
Mysql Ver 14.14 Distrib 5.5.15, for Linux (i686) using EditLine wrapper
It indicates that the mysql client is ready for use.
5. Configure MySQL Server:
~ $ Sudo install-m644/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
(Note: Select my-medium.cnf or my-large.cnf, my-huge.cnf according to actual needs)
~ $ Sudo/usr/local/mysql/scripts/mysql_install_db -- user = mysql -- datadir =/var/lib/mysql
~ $ Sudo install-m755/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
Edit/etc/my. cnf, add datadir =/var/lib/mysql under [mysqld], and then start MySQL server:
~ $ Sudo/etc/init. d/mysqld start
If the preceding command does not return an error, it indicates that the MySQL 5.5.15 server has been installed successfully. Set the root password first:
~ $ Mysqladmin-u root password <root-password>
~ $ Mysql-u root-p
Modify/etc/my. cnf to complete further configuration.