学习啦>学习电脑>操作系统>Linux教程>

linux的rpm命令安装mysql

时间: 佳洲1085 分享

  Linux下我们可以使用rpm来安装mysql软件包,下面由学习啦小编为大家整理了linux下rpm命令安装mysql的相关知识,希望对大家有帮助!

  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! ”

  如出现如上信息,则表示服务器端安装成功

  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的相关文件应该可以手动删除了 示例 rm -rf /var/lib/mysql

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

  rpm命令参数:--force忽略软件包及文件的冲动

  --nodeps 不检查依赖性关系

  --dbpath设置RPM资料库所在的路径

  --prefix 将软件包安装到由指定的目录下

3630570