1) 下載Mysql5.5的Linux - Generic包:http://download.softagency.net/mysql/Downloads/MySQL-5.5/我下載的是 mysql-5.5.17-linux2.6-x86_64.tar.gz。
2) 確定已安裝的mysql被徹底卸載了詳見 Ubuntu 11.04 通過 apt 安裝 Mysql 5.1 的全過程記錄 (見 )中關於如何卸載Mysql5.1的詳細說明確認如下目錄和檔案已被刪除$ sudo rm -R /etc/mysql$ sudo rm /etc/my.cnf$ sudo rm /etc/init.d/mysql
3) 安裝$ su -- 切換到root帳號# apt-get install libaio-dev # groupadd mysql -- 添加mysql使用者組# useradd -r -g mysql mysql -- 添加mysql使用者# cd /usr/local# tar zxvf /path/to/mysql-VERSION-OS.tar.gz -- 解壓二進位安裝包# ln -s full-path-to-mysql-VERSION-OS mysql -- 建立軟連結# cd mysql# chown -R mysql . -- 修改目錄所屬的擁有者# chgrp -R mysql . -- 修改目錄所屬的使用者組# scripts/mysql_install_db --user=mysql -- 執行資料庫安裝命令
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h bcserver4utest password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
# chown -R root .# chown -R mysql data# cp support-files/my-medium.cnf /etc/my.cnf -- [可選]複製設定檔
4) 以mysql使用者在後台啟動資料庫 # bin/mysqld_safe --user=mysql &
預設情況:資料檔案在data目錄下
5) 建立自啟動指令碼# cp support-files/mysql.server /etc/init.d/mysql以後啟動直接輸入 # /etc/init.d/mysql restart|start
進入資料庫管理命令 $ bin/mysql -u -root -p