學習啦>學習電腦>操作系統(tǒng)>Linux教程>

linux的rpm命令安裝mysql

時間: 佳洲1085 分享

  Linux下我們可以使用rpm來安裝mysql軟件包,下面由學習啦小編為大家整理了linux下rpm命令安裝mysql的相關(guān)知識,希望對大家有幫助!

  linux的rpm命令安裝mysql詳解

  1.軟件包準備

  下載 MySQL-server-5.5.23-1.linux2.6.i386.rpm 和 MySQL-client-5.5.23-1.linux2.6.i386.rpm

  2.安裝mysql

  1)安裝服務器端

  在rpm包的目錄下運行以下命令:

  [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)如上信息,則表示服務器端安裝成功

  2)安裝客戶端

  運行如下命令

  [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)文件應該可以手動刪除了 示例 rm -rf /var/lib/mysql

  mysql停止:/usr/bin/mysqladmin -u root -p shutdown

  rpm命令參數(shù):--force忽略軟件包及文件的沖動

  --nodeps 不檢查依賴性關(guān)系

  --dbpath設置RPM資料庫所在的路徑

  --prefix 將軟件包安裝到由指定的目錄下

3630570