1. Download the MySQL 5.5 Deb installation package
Cd/usr/local/src
sudo wget-o mysql-5.5.22-debian6.0-i686.deb http://dev.mysql.com/get/Downloads/MySQL-5.5/ mysql-5.5.22-debian6.0-i686.deb/from/http://mysql.ntu.edu.tw/
2. Install the Deb package
sudo dpkg-i mysql-5.5.22-debian6.0-i686.deb
MySQL server is initialized in/opt/mysql/server-5.5
3. Enable MySQL
Groupadd MySQL
Useradd-r-G MySQL MySQL
sudo apt-get install Libaio-dev
Ln-s/opt/mysql/server-5.5/usr/local/mysql
sudo mkdir/usr/local/mysql/data
sudo chown-r MySQL. /usr/local/mysql/data
Initializing the database
sudo/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/ Data
Put the Mysqld startup shell program into the system service directory
sudo cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
put the MySQL configuration file in the system configuration/etc directory, MySQL in global scope To use this configuration file
sudo cp/usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
Start MySQL
Sudo/etc/init.d/mysql start
Change the MySQL root administrator password
sudo/usr/local/mysql/bin/mysqladmin-u root Password [password you wish to set]
Test if you can log in to MySQL
Sudo/usr/local/mysql/bin/mysql-u root-p [optional database name]
Mysql.sock stored in /tmp/mysql.sock
Note: If you add mysql_server to the system service directory/etc/init.d/you must ensure that the MySQL program directory is in/usr/local/mysql, which can be pointed to by means of a soft link to other really installed directories.
If you install Mysql-common after this, the configuration file for MySQL server will be affected, you will need to change the Basedir, DataDir, and log in/etc/mysql/my.cnf or modify the settings in php.ini, such as PDO
Ubuntu installs MySQL5.5 with Deb (reprint)