CentOS 安裝MySQL 5.5.9

來源:互聯網
上載者:User

由於開發需要,現在需要安裝安裝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!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.