Redhat Linux上mysql安装-RPM安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redhat Linux上mysql安装-RPM安装相关的知识,希望对你有一定的参考价值。

Linux平台上mysql通常有三种安装方式,即:

Rpm安装

通用二制包安装

安装包

本文先就RPM安装方式介绍,在此主要还是开源的社区版本介绍,首先下载

http://dev.mysql.com/downloads/mysql/

可以选择针对不同平台的安装包类型,目前最新的版本是5.7.11,RPM版本也有各种类型,了解了此,才能选择合适的安装包:

Package Name

Summary

mysql-community-server

Database server and  related tools

mysql-community-client

MySQL client  applications and tools

mysql-community-common

Common files for  server and client libraries

mysql-community-devel

Development header  files and libraries for MySQL database client applications

mysql-community-libs

Shared libraries  for MySQL database client applications

mysql-community-libs-compat

Shared  compatibility libraries for previous MySQL installations

mysql-community-embedded

MySQL embedded  library

mysql-community-embedded-devel

Development header  files and libraries for MySQL as an embeddable library

mysql-community-test

Test suite for the  MySQL server

 

其具体名称结构如下:

packagename-version-distribution-arch.rpm

version就不用说啦,其实就是数据库的版本,distribution和arch表示的是为何种LINUX类型和CPU平台构建的安装包,具体的分发标志如下:

distribution Value

Intended Use

el5, el6, el7

Red  Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7

fc22, fc23

Fedora  22 or 23

sles12

SUSE  Linux Enterprise Server 12

 

比如:mysql-community-server-5.7.11-1.el7.x86_64.rpm,就是RedHat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit),上的RPMPackage
MySQL Server
安装包

 

安装呢就很简单:

shell> rpm -qpl mysql-community-server-version-distribution-arch.rpm

可以看到RPM包安装起来简单,比较适合初学者,但是需要根据具体需求下载合适的安装包如server和client需要单独分开安装,具体参见上表;

另外就是安装路径不灵活,默认路径不可修改,所以一台server上只能安装一个server,具体路径如下:

Files or Resources

Location

Client  programs and scripts

/usr/bin

mysqld  server

/usr/sbin

Configuration  file

/etc/my.cnf

Data  directory

/var/lib/mysql

Error  log file

For  RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log

For  SLES: /var/log/mysql/mysqld.log

Value  of secure_file_priv

/var/lib/mysql-files

System  V init script

For  RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld

For  SLES: /etc/init.d/mysql

Systemd  service

For  RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld

For  SLES: mysql

Pid  file

/var/run/mysql/mysqld.pid

Socket

/var/lib/mysql/mysql.sock

Keyring  directory

/var/lib/mysql-keyring

Unix  manual pages

/usr/share/man

Include  (header) files

/usr/include/mysql

Libraries

/usr/lib/mysql

Miscellaneous  support files (for example, error messages, and character set files)

/usr/share/mysql

 

安装完毕后MYSQL并不是自动启动,而需要手工启动:

shell> service mysqld start

 

初始化启动服务器后,超级账户’root’@localhost’被创建,用户密码被生产放在了error log文件中,采用
shell> grep ‘temporary password‘ /var/log/mysqld.log

可以找到,登陆修改密码即可:

shell> mysql -uroot -p
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;

 

这样就完成了rpm安装包的安装,还是挺快的。


本文出自 “Marvelyu's Notes” 博客,请务必保留此出处http://marvelyu.blog.51cto.com/471030/1747802

以上是关于Redhat Linux上mysql安装-RPM安装的主要内容,如果未能解决你的问题,请参考以下文章

RedHat 6.5上使用RPM包安装MySQL 5.6

Linux怎么查看软件安装路径 查看mysql安装在哪

linux redhat 7 安装 mysql5.5

(15)RPM软件包管理

Linux redhat ICE环境安装

redhat6.5安装yum