在CentOS 7上安裝MySQL 5.1需要遵循以下步驟:
1. 確認(rèn)CentOS 7上MySQL的依賴庫(kù)
$ sudo yum install -y perl
2. 下載MySQL源代碼
$ wget https://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73.tar.gz
3. 解壓源代碼
$ tar zxvf mysql-5.1.73.tar.gz
4. 安裝編譯工具
$ sudo yum install -y gcc-c++ make automake autoconf libtool openssl-devel
5. 進(jìn)入MySQL源代碼目錄
$ cd mysql-5.1.73
6. 配置MySQL安裝選項(xiàng)
$ sudo ./configure --prefix=/usr/local/mysql \ --with-charset=utf8 \ --with-extra-charsets=none \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \ --with-plugins=innobase \ --with-mysqld-ldflags=-all-static \ --without-docs \ --without-man \ --with-client-ldflags=-static
7. 編譯MySQL源代碼
$ sudo make
8. 安裝MySQL
$ sudo make install
9. 初始化MySQL
$ sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
10.啟動(dòng)MySQL
$ sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
11.設(shè)置MySQL的root賬戶密碼
$ sudo /usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'
12.測(cè)試MySQL是否安裝成功
$ sudo /usr/local/mysql/bin/mysql -uroot -p
以上是在CentOS 7上安裝MySQL 5.1的詳細(xì)步驟,希望對(duì)大家有所幫助。