LAMP架构、MYSQL安装

LAMP架构

1.lamp包含什么

  1. httpd、PHP、MySQL三者如何工作
    MySQL存储用户名,密码一些数据,图片之类的放在静态文件里

    MySQL_MariaDB介绍

    MySQL安装

1.首先下载软件包

[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
--2018-02-26 21:12:00--  http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
正在解析主机 mirrors.sohu.com (mirrors.sohu.com)... 221.236.12.140
正在连接 mirrors.sohu.com (mirrors.sohu.com)|221.236.12.140|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:316320366 (302M) [application/octet-stream]
正在保存至: “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz”

100%[====================================>] 316,320,366  525KB/s 用时 11m 2s 

2018-02-26 21:23:02 (467 KB/s) - 已保存 “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz” [316320366/316320366])

2.解压缩

tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

3.移动目录并改名

[[email protected] src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql

4.进入mysql目录

[[email protected] src]# cd /usr/local/mysql/
[[email protected] mysql]# ls
bin      data  include  man         README   share      support-files
COPYING  docs  lib      mysql-test  scripts  sql-bench

5.创建用户,目录并初始化

[[email protected] mysql]# useradd mysql
[[email protected] mysql]# mkdir /data/
[[email protected] mysql]# ls /data/
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper

6.有报错,需要安装perl包:

[[email protected] mysql]# yum install -y perl-Data-Dumper
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装
--> 解决依赖关系完成

7.完成后继续执行,有报错:

[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

需要安装

[[email protected] mysql]# yum install -y libaio-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 libaio-devel.x86_64.0.0.3.109-13.el7 将被 安装
--> 正在处理依赖关系 libaio(x86-64) = 0.3.109-13.el7,它被软件包 libaio-devel-0.3.109-13.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libaio.x86_64.0.0.3.109-13.el7 将被 安装

8.初始化:

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
Installing MySQL system tables...2018-02-26 22:25:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-26 22:25:59 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-02-26 22:25:59 0 [Note] ./bin/mysqld (mysqld 5.6.36) starting as process 1622 ...
2018-02-26 22:25:59 1622 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-02-26 22:25:59 1622 [Note] InnoDB: The InnoDB memory heap is disabled
2018-02-26 22:25:59 1622 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-02-26 22:25:59 1622 [Note] InnoDB: Memory barrier is not used
2018-02-26 22:25:59 1622 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-02-26 22:25:59 1622 [Note] InnoDB: Using Linux native AIO

9.执行完成后马上执行

[[email protected] mysql]# echo $?
0

检验上一条是否正确,0为正确
10.复制配置文件,或更改自带文件

[[email protected] mysql]# cp support-files/my-default.cnf  /etc/my.cnf^C
[[email protected] mysql]# ls /etc/my.cnf
/etc/my.cnf
[[email protected] mysql]# rpm -qf /etc/my.cnf
mariadb-libs-5.5.56-2.el7.x86_64

[[email protected] mysql]# vim /etc/my.cnf

[mysqld]
datadir=/data/mysql
socket=/tmp/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
#!includedir /etc/my.cnf.d

11.复制启动脚本

[[email protected] mysql]# ls support-files/
binary-configure  my-default.cnf       mysql-log-rotate
magic             mysqld_multi.server  mysql.server
[[email protected] mysql]# cp support-files/mysql.server  /etc/init.d/mysqld

12.更改启动脚本:
[[email protected] mysql]# vi /etc/init.d/mysqld


basedir=/usr/local/mysql
datadir=/data/mysql

13.设置开机启动

[[email protected] mysql]# chkconfig --add mysqld
[[email protected] mysql]# chkconfig --list

注:该输出结果只显示 SysV 服务,并不包含
原生 systemd 服务。SysV 配置数据
可能被原生 systemd 配置覆盖。 

      要列出 systemd 服务,请执行 ‘systemctl list-unit-files‘。
      查看在具体 target 启用的服务请执行
      ‘systemctl list-dependencies [target]‘。

mysqld          0:关 1:关 2:开 3:开 4:开 5:开 6:关
netconsole      0:关 1:关 2:关 3:关 4:关 5:关 6:关
network         0:关 1:关 2:开 3:开 4:开 5:开 6:关

14.立刻启动程序:

[[email protected] mysql]# service mysqld start
Starting MySQL.Logging to ‘/data/mysql/weixing01.err‘.
. SUCCESS!

15.采用命令行方式启动:

[[email protected] mysql]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql &
[1] 2101
[[email protected] mysql]# 180226 22:44:15 mysqld_safe Logging to ‘/data/mysql/weixing01.err‘.
180226 22:44:15 mysqld_safe Starting mysqld daemon with databases from /data/mysql

16.用killall杀死程序,比kill保险,不会在磁盘读写时损坏数据

[[email protected] mysql]# killall mysqld
[[email protected] mysql]# 180226 22:47:13 mysqld_safe mysqld from pid file /data/mysql/weixing01.pid ended

[1]+  完成                  /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql
[[email protected] mysql]# ps aux |grep mysql
root       2398  0.0  0.0 112676   984 pts/0    R+   22:47   0:00 grep --color=auto mysql

原文地址:http://blog.51cto.com/13517254/2073299

时间: 2024-07-31 14:15:10

LAMP架构、MYSQL安装的相关文章

Linux 学习总结(三十)lamp之mysql安装

一 lamp架构介绍 lamp 是linux apache mysql php 的缩写,就是整个一套服务端环境,对于php开发的网站,我们访问到的页面或者数据很可能就是这套环境提供的.对于普通网民来说,我们没有注意我们访问到的网站内容,其实是分两大类的,一类是图片为代表的静态数据,一类是存储在数据库中的动态数据,比如我们登陆博客的用户名密码等.我们根据下图分解下各部分原理,linux当然是指我们的linux操作系统centos,ubuntu等.apache我们都知道他是一个基金会的名字,其实质是

在LAMP架构中安装Memcached高性能内存对象缓存应用(内含所有源码包)

初识memcached: Memcached是一套开源的高性能分布式内存对象缓存系统,它将所有的数据都存储在内存中,因为在内存中会统一维护一张巨大的hash表,所以支持任意存储类型的数据.很多网站通过使用memcached提高网站的访问速度,尤其是对于大型的需要频繁访问数据的网站. Memcached是典型的C/S结构,因此需要安装memcached服务端和memcached API客户端.Memcached服务端是用C语言编写的,而memcached API客户端可以用任何语言来编写,如PHP

LAMP架构之安装MySQL

一.安装前需知1.同安装Apache一样需要将Linux上光盘进行挂载2.安装MySQL需要准备mysql-5.5.24.tar.gz软件包,还需安装环境包,包括: gcc . gcc-c++ .make.cmake .ncurses-devel(字符终端屏幕控制基本库).bison(语法分析器).libaio-devel (支持同步I/O)的软件包),为解决软件包的依赖关系需要事先建立yum仓库,使用yum仓库进行安装3.由于是在虚拟机中安装,需要用的软件包是从宿主机中利用共享文件夹的方式共享

LAMP 之 mysql 安装

搞了成日 = = 呢个野.... 大部分东西写在 印象笔记 中....不过呢个野特别繁琐,所以记录落黎(小白一枚,大家见谅) 总结下,唔系好容易唔记得 >W< (可能唔会甘完整,我将我自认为噶易错点整罗黎) ######################## 正题 action~ LAMP:linux,apache,mysql,php 的集合体 总的步骤就为: 1.安装 MySql (下载免编译二进制包: wget  + 链接: 解压 tar zxvf + .gz) 2.创建运行 mysql 的

LAMP架构的安装与经验技巧

LAMP:linux+Apache+Mysql+PHP 1.apache的安装与使用经验 可以通过源码(推荐)和yum安装,源码可以使用最新的安装,并且可以指定安装的路径, 方便以后维护. (1)apache需要的相关库文件 [[email protected] ~]#cd apr-1.4.5 [[email protected] ~]#./configure  --prefix=/usr/local/apr [[email protected] ~]#make && make insta

Linux(Centos 7) LAMP架构之安装Apache

1.Centos7直接使用yum安装Apache yum install httpd 2.防火墙设置,开启80端口 firewall-cmd --permanent --zone=public  --add-service=http firewall-cmd --permanent --zone=public  --add-service=https firewall-cmd --reload 3.设置服务器开机启动Apache systemctl enable httpd.service #设

redhat下安装LAMP架构

LAMP指的Linux.ApacheHTTP 服务器,MySQL数据可 和PHP 的第一个字母,是用来建立web应用的一个平台.一. 手工编译安装apache1.将安装apache需要用到的包,解压到/opt目录下命令如下:tar xzvf http-2.4.2.tar.gz -C /opttar xzvf apr-1.4.6.tar.gz -C /opt (支持Apache上层应用跨平台,提供底层接口库)tar xzvf apr-util-1.4.1.tar.gz -C /opt安装好之后可以

源码安装LAMP架构

一. 实验目的通过源码部署LAMP环境并在此基础上部署phpmyadmin二. 实验内容在虚拟机中搭建网络YUM仓库,依次安装httpd php php-server mysql(mairadb)及各自的依赖的库和相关的工具包,并分别验证php和httpd的勾连,php和mysql的勾连,之后在网页根路径部署phpmyadmin,在浏览器验证即可,三. 实验环境与准备一台Centos6虚拟机,网卡设置为桥接模式,并连接xshell四. 实验分析与设计思路在Centos6搭建LAMP架构,首先搭建

LAMP架构之——MySQL安装

本节讲述的是mysql的安装过程,这里我们使用二进制格式进行安装.我用的是mariadb-5.5.36-linux-x86_64.tar.gz进行安装. 1.准备数据存放的文件系统 一般数据库的大小会一直变大,因此我们用逻辑卷来存放. 新建一个逻辑卷,并将其挂载至特定目录即可. 并修改文件系统类型 这里假设其逻辑卷的挂载目录为/mydata,而后需要创建/mydata/data目录做为mysql数据的存放目录. 当然这里的目录都是需要实现创建的,这里我就不演示了. 2.新建用户以安全方式运行进程

11.1 LAMP架构介绍 11.2 MySQL、MariaDB介绍 11.3/11.4/11.5 MySQL安装

11.1 LAMP架构介绍 11.2 MySQL.MariaDB介绍 11.3/11.4/11.5 MySQL安装 扩展 mysql5.5源码编译安装 http://www.aminglinux.com/bbs/thread-1059-1-1.html mysql5.7二进制包安装(变化较大) http://www.apelearn.com/bbs/thread-10105-1-1.html 11.1 LAMP架构介绍 Linux + Apache(httpd)+ MySQL + PHP  PH