由於開發需要,現在需要安裝安裝MySQL 5.5.9,使用了rpm安裝總是出錯,而且還有好多依事關係麻煩,此外也沒有找到二進位的包,只好找源碼包進行編譯;
[root@linuxidc www.linuxidc.com]# uname -a
Linux test 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
首先,需要下載安裝Cmake;
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
安裝cmake;
tar xvzf cmake-2.8.4.tar.gz
./configure
make
make install
下載mysql,可以去官方網站找到你所需要的;
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz
編譯安裝mysql
cd mysql5.5.9
rm CMakeCache.txt
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0
我在編譯的時候報錯,意思是DMYSQL_USER=mysql無效,懶得找原因,直接把那個參數給去掉了,接著進行下面的操作;
make && make install
完成後進入MYSQL安裝目錄
cd /usr/local/mysql
cp support-files/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf
將資料目錄和通訊端檔案修改為你自己設定的路徑值,我幾乎沒有改.
現在需要更改許可權;
chown mysql:mysql /etc/my.cnf
chown -R mysql:mysql /usr/local/mysql
切換使用者進入安裝目錄
su – mysql
cd /usr/local/mysql/scripts
./mysql_install_db
啟動MYSQL
bin/mysqld_safe &
查看連接埠;
[root@linuxidc www.linuxidc.com]# netstat -an | grep 3306
tcp 0 0 :::3306 :::* LISTEN
[root@linuxidc www.linuxidc.com]# ps aux | grep mysql | grep -v 'grep'
mysql 15747 0.0 0.0 63828 1268 pts/3 S 11:03 0:00 /bin/sh ./mysqld_safe
mysql 15985 0.0 5.5 765088 114340 pts/3 Sl 11:03 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/test.err --pid-file=/usr/local/mysql/data/bailianweb64.pid --socket=/usr/local/mysql/data/mysql.sock --port=3306
root 16031 0.0 0.1 92996 2416 pts/4 S+ 11:06 0:00 ./mysql
如下進行phpmyadmin 設定,此處略去一萬字……
OK,到此操作結束!
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 localhost.localdomain 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!