CentOS/Linux下面用rpm方法安裝mysql5.1
首先還是要下載,因為我是64位的Linux,所以下載的是64bit的版本,需要下三個檔案server和
64bit mysql
MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm
http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://mysql.cdpa.nsysu.edu.tw/Unix/Database/MySQL/
MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm
http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://ftp.stu.edu.tw/pub/Unix/Database/Mysql/
MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm
http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://ftp.mirror.tw/pub/mysql/
32bit和更多下載鏡像,請自己上www.mysql.com下載
這裡預設下載目錄為/usr/local/src/
依次執行以下命令
#下載所需rpm包
cd /usr/local/src/
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://mysql.cdpa.nsysu.edu.tw/Unix/Database/MySQL/
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://ftp.stu.edu.tw/pub/Unix/Database/Mysql/
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm/from/ftp://ftp.mirror.tw/pub/mysql/
#開始安裝
rpm -ivh MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm
然後運行一下mysql看是否安裝成功
mysql
提示:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.36-community-log MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
即為安裝成功
修改登入密碼:
mysqladmin -u root password ‘new-password’
格式:mysqladmin -u使用者名稱 -p舊密碼 password 新密碼
再次登入
mysql -u root -p
本文來自:http://www.yuwuxing.cn/?p=104