Lamp architecture
What 1.lamp contains
- How httpd, PHP, and MySQL work
MySQL store user name, password some data, pictures and so on in the static file
MYSQL_MARIADB IntroductionMySQL Installation
1. Download the package first
[[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. Unzip
3. Move the directory and rename it
[[email protected] src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql
4. Go to MySQL Directory
[[email protected] src]# cd /usr/local/mysql/[[email protected] mysql]# lsbin data include man README share support-filesCOPYING docs lib mysql-test scripts sql-bench
5. Create a user, directory, and initialize
[[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/mysqlFATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper
6. There is an error, need to install Perl package:
[[email protected] mysql]# yum install -y perl-Data-Dumper已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cn正在解决依赖关系--> 正在检查事务---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装--> 解决依赖关系完成
7. Continue execution after completion, with error:
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlInstalling MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
Need to install
[[email protected] mysql]# yum install -y libaio-devel已加载插件:fastestmirrorLoading 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. Initialize:
./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlInstalling 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 pages2018-02-26 22:25:59 1622 [Note] InnoDB: The InnoDB memory heap is disabled2018-02-26 22:25:59 1622 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2018-02-26 22:25:59 1622 [Note] InnoDB: Memory barrier is not used2018-02-26 22:25:59 1622 [Note] InnoDB: Compressed tables use zlib 1.2.32018-02-26 22:25:59 1622 [Note] InnoDB: Using Linux native AIO
9. Execute immediately upon completion of execution
[[email protected] mysql]# echo $?0
Verify that the previous one is correct, 0 is correct
10. Copy the configuration file or change your own file
[[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.cnfmariadb-libs-5.5.56-2.el7.x86_64
[Email protected] mysql]# VIM/ETC/MY.CNF
[mysqld]datadir=/data/mysqlsocket=/tmp/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-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. Copy the startup script
[[email protected] mysql]# ls support-files/binary-configure my-default.cnf mysql-log-rotatemagic mysqld_multi.server mysql.server[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
12. Change the startup script:
[Email protected] mysql]# Vi/etc/init.d/mysqld
basedir=/usr/local/mysqldatadir=/data/mysql
13. Set Boot up
[[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. Start the program now:
15. Start by using the command line mode:
[[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. Kill the program with Killall, than kill insurance, will not damage the data when the disk read and write
[[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 mysqlroot 2398 0.0 0.0 112676 984 pts/0 R+ 22:47 0:00 grep --color=auto mysql
Lamp architecture, MySQL installation