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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

LAMP架构介绍

LAMP指的L(linux)、A(Apache)、M(mysql)、P(php);apache+php需要在一台主机,mysql可以分开也可以在同一台主机上运行。

工作模式如下:

4a19cd26869d4fd4324c3211d4f582dd.png-wh_

静态文件:图片、文档,不用通过加载mysql去取数据

动态文件:js等通过php模块调用mysql,再通过apache展示来实现的动态资源


MySQL,MariaDB介绍

mysql:关系型数据库,由sun公司研发,后被oracle公司收购;

其版本:

community 社区版;enterprise 企业版;GA(generally available) 通用版,在生产环境中使用;DMR(development milestone release) 开发里程碑版本;RC(release candidate) 发行候选版本;Beta 公测版本;Alpha 内部测试版本。

MariaDB:和mysql基本一致,是mysql的一个分支。


MySQL安装

常用的安装包:

rpm包(rpm -ivh 安装)

源码包(源代码编译安装,耗时比较久,一般也得20多分钟)

二进制免编译包(已经编译好的,拿来就可以直接使用,简单快速安装)


1、下载安装包(二进制免编译包):

[root@centos7 package]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

2、解压

[root@centos7 package]# tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 

3、[root@centos7 package]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql

4、创建mysql、data目录

[root@centos7 mysql]# useradd mysql

[root@centos7 mysql]# mkdir /data/ 

5、安装相应的软件包

[root@centos7 mysql]# yum install -y perl-Data-Dumper libaio* libaio-dev*

6、初始化

[root@centos7 mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

7、验证是否正确

[root@centos7 mysql]# echo $?

0

8、拷贝配置文件到/etc

[root@centos7 mysql]# cp support-files/my-default.cnf  /etc/my.cnf

cp: overwrite ‘/etc/my.cnf’? y

9、新增datadir、socket:

[root@centos7 mysql]# 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.


[mysqld]

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、启动脚本:

[root@centos7 mysql]# cp support-files/mysql.server /etc/init.d/mysqld 

[root@centos7 mysql]# vi /etc/init.d/mysqld 

basedir=/usr/local/mysql

datadir=/data/mysql


11、[root@centos7 mysql]# chmod 755 /etc/init.d/mysqld

12、

[root@centos7 mysql]# chkconfig --add mysqld

[root@centos7 mysql]# 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 [target]'.


mysqld          0:off 1:off 2:on 3:on 4:on 5:on 6:off

13、启动

[root@centos7 mysql]# /etc/init.d/mysqld start

14、[root@centos7 mysql]# netstat -nutlp| grep mysqld

tcp6       0      0 :::3306                 :::*                    LISTEN      18112/mysqld 

14、错误信息:

[root@centos7 ~]# killall

-bash: killall: command not found


解决:[root@centos7 ~]# yum install psmisc -y

15、[root@centos7 ~]# killall mysqld

16、没有启动脚本时,如下启动:

[root@centos7 ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql &

17、[root@centos7 ~]# ps aux|grep mysql













本文转自方向对了,就不怕路远了!51CTO博客,原文链接:http://blog.51cto.com/jacksoner/1979858 ,如需转载请自行联系原作者




相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
Ubuntu 关系型数据库 MySQL
Ubuntu 18.04安装lamp环境并配置mysql数据库远程连接
Ubuntu 18.04安装lamp环境并配置mysql数据库远程连接
205 0
Ubuntu 18.04安装lamp环境并配置mysql数据库远程连接
|
弹性计算 关系型数据库 MySQL
LAMP环境的搭建及使用ECS服务器部署MySQL数据库
本文主要介绍如何在阿里云上快速搭建LAMP环境及使用ECS服务器部署MySQL数据库
246 0
|
关系型数据库 MySQL
|
Web App开发 关系型数据库 MySQL

推荐镜像

更多