-★出爺;3 发表于 2018-10-7 09:59:28

LAMP架构介绍、MySQL,MariaDB介绍、MySQL安装

  LAMP架构介绍
  LAMP指的L(linux)、A(Apache)、M(mysql)、P(php);apache+php需要在一台主机,mysql可以分开也可以在同一台主机上运行。
  工作模式如下:

  静态文件:图片、文档,不用通过加载mysql去取数据
  动态文件:js等通过php模块调用mysql,再通过apache展示来实现的动态资源
  MySQL,MariaDB介绍
  mysql:关系型数据库,由sun公司研发,后被oracle公司收购;
  其版本:
  community 社区版;enterprise 企业版;GA(generally available) 通用版,在生产环境中使用;DMR(development milestone>
  MariaDB:和mysql基本一致,是mysql的一个分支。
  MySQL安装
  常用的安装包:
  rpm包(rpm -ivh 安装)
  源码包(源代码编译安装,耗时比较久,一般也得20多分钟)
  二进制免编译包(已经编译好的,拿来就可以直接使用,简单快速安装)
  1、下载安装包(二进制免编译包):
  # wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
  2、解压
  # tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
  3、# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
  4、创建mysql、data目录
  # useradd mysql
  # mkdir /data/
  5、安装相应的软件包
  # yum install -y perl-Data-Dumper libaio* libaio-dev*
  6、初始化
  # ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
  7、验证是否正确
  # echo $?
  0
  8、拷贝配置文件到/etc
  # cp support-files/my-default.cnf/etc/my.cnf
  cp: overwrite ‘/etc/my.cnf’? y
  9、新增datadir、socket:
  # cat /etc/my.cnf
  # For advice on how to change settings please see
  # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
  # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
  # *** default location during install, and will be replaced if you
  # *** upgrade to a newer version of MySQL.
  
  datadir=/data/mysql
  socket=/tmp/mysql.sock
  # Remove leading # and set to the amount of RAM for the most important data
  # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
  # innodb_buffer_pool_size = 128M
  10、启动脚本:
  # cp support-files/mysql.server /etc/init.d/mysqld
  # vi /etc/init.d/mysqld
  basedir=/usr/local/mysql
  datadir=/data/mysql
  11、# chmod 755 /etc/init.d/mysqld
  12、
  # chkconfig --add mysqld
  # chkconfig --list| grep mysqld
  Note: This output shows SysV services only and does not include native
  systemd services. SysV configuration data might be overridden by native
  systemd configuration.
  If you want to list systemd services use 'systemctl list-unit-files'.
  To see services enabled on particular target use
  'systemctl list-dependencies '.
  mysqld         0:off1:off2:on3:on4:on5:on6:off
  13、启动
  # /etc/init.d/mysqld start
  14、# netstat -nutlp| grep mysqld
  tcp6       0      0 :::3306               :::*                  LISTEN      18112/mysqld
  14、错误信息:
  # killall
  -bash: killall: command not found
  解决:# yum install psmisc -y
  15、# killall mysqld
  16、没有启动脚本时,如下启动:
  # /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql &
  17、# ps aux|grep mysql

页: [1]
查看完整版本: LAMP架构介绍、MySQL,MariaDB介绍、MySQL安装