linux的rpm命令安裝mysql
Linux下我們可以使用rpm來(lái)安裝mysql軟件包,下面由學(xué)習(xí)啦小編為大家整理了linux下rpm命令安裝mysql的相關(guān)知識(shí),希望對(duì)大家有幫助!
linux的rpm命令安裝mysql詳解
1.軟件包準(zhǔn)備
下載 MySQL-server-5.5.23-1.linux2.6.i386.rpm 和 MySQL-client-5.5.23-1.linux2.6.i386.rpm
2.安裝mysql
1)安裝服務(wù)器端
在rpm包的目錄下運(yùn)行以下命令:
[root@gc01vm4 local]# rpm -ivh MySQL-server-5.5.23-1.linux2.6.i386.rpm
顯示如下信息:“
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h gc01vm4 password 'new-password'
Alternatively you can run:
/usr/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.
Please report any problems with the /usr/bin/mysqlbug script! ”
如出現(xiàn)如上信息,則表示服務(wù)器端安裝成功
2)安裝客戶端
運(yùn)行如下命令
[root@gc01vm4 local]# rpm -ivh MySQL-client-5.5.23-1.linux2.6.i386.rpm
顯示如下信息則表明安裝成功:
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
附:linux下rpm命令卸載mysql
MySQL-server-5.0.27-0.glibc23
然后,
# rpm -e --nodeps MySQL-server-5.0.27-0.glibc23
不行的話可以用#rpm -e --allmatches MySQL-server-5.0.27-0.glibc23 搞定。再
# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/var/lock/subsys/mysql
mysql的相關(guān)文件應(yīng)該可以手動(dòng)刪除了 示例 rm -rf /var/lib/mysql
mysql停止:/usr/bin/mysqladmin -u root -p shutdown
rpm命令參數(shù):--force忽略軟件包及文件的沖動(dòng)
--nodeps 不檢查依賴性關(guān)系
--dbpath設(shè)置RPM資料庫(kù)所在的路徑
--prefix 將軟件包安裝到由指定的目錄下