Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of LAMP architecture and MySQL_MariaDB and installation of MySQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Introduction to 1.LAMP Architecture

Linux+Apache (httpd) + MySQL+PHP

PHP website (Google, Taobao, Baidu, 51cto podcast, ape forum)

The three roles can be on the same machine or separately.

You can refer to other documents:

Https://www.cnblogs.com/jiangjunli/p/6958605.html

Http://blog.csdn.net/zdp072/article/details/50583581

2.MySQL_MariaDB introduction

MySQL/Mariadb introduction

MySQL is a relational database developed by mysql ab. Mysql was acquired by sun in 2008 ($1 billion) and sun by Oracle in 2009 ($7.4 billion).

The latest version of https://www.mysql.com, MySQL official website, 5.7GA/8.0DMR

MysSQL5.6 has changed greatly, and its performance has been greatly improved.

Mariadb is a branch of MySQL. The latest version of https://mariadb.com is 10.2.

MariaDB is mainly maintained by SkySQL (now renamed MariaDB). SkySQL was founded by most of the original people led by the original author of MySQL.

Mariadb5.5 version corresponds to mysql 5.5,10.0 corresponds to mysql5.6.

Community community version, Enterprise enterprise version, GA (Generally Available) refers to general version, used in production environment, DMR (Development Milestone Release) development milestone release, RC (Release Candidate) release candidate, Beta open test, Alpha internal test

3.MySQL installation

Install MySQL

Several common installation packages for MySQL: rpm, source code, binary compiler-free

Cd / usr/local/src storage resource directory

# create a multi-level directory with mkdir-p / usr/local/src/ [root@yunlinux ~] # cd / usr/local/src

Wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz download address, download package (in binary)

Tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz decompresses the file

Mv mysql-5.6.35-linux-glibc2.5-x86_64 / usr/local/mysql

# modify the name of the directory and put it in the / usr/local/mysql directory [root@yunlinux src] # lsmysql-5.6.36-linux-glibc2.5-x86_64 mysql-5.6.36-linux-glibc2.5-x86_ 64.tar.gz [root @ yunlinux src] # mv mysql-5.6.36-linux-glibc2.5-x86_64 / usr/local/mysql

Cd / usr/local/mysql

# enter [root@yunlinux src] # cd / usr/local/mysql under the / usr/local/mysql directory

Useradd mysql

# create mysql user [root@yunlinux mysql] # useradd mysql

Mkdir / data/

# create a directory to store mysql data files [root@yunlinux mysql] # mkdir / data/

. / scripts/mysql_install_db-user=mysql-datadir=/data/mysql

# initialize, generate / data/mysql directory [initialize specified user as mysql, specify datadir as / data/mysql directory] [root@yunlinux mysql] #. / scripts/mysql_install_db-- user=mysql-- datadir=/data/mysql

An error is reported and translated into Chinese as follows:

Fatal error: please install the following Perl module before execution. / script / mysql_install_db:

Data::Dumper

The solution is as follows:

Fuzzy search related support package name

[root@yunlinux mysql] # yum list | grep perl | grep-I dumper# fuzzy search perl and dumper-I ignore case

If still not, Baidu or Baidu, Bing and Google have the best quality, it is recommended to use Bing in China.

You can install it all or try it one by one until you don't report an error, which is the correct installation.

[root@yunlinux mysql] # yum install-y perl-Data-Dumper

If you go back to the first step and re-execute it, how can you make sure it is installed correctly?

In the first method, there are two OK during installation, indicating that the installation is correct.

The second method is to use echo $? To check whether the previous order is correct!

Cp support-files/my-default.cnf / etc/my.cnf

There is a template configuration file my-default.cnf. My-default.cnf in the support-files directory. And it's commented out.

When copying, you are prompted to overwrite the previous configuration file. Can you find out which bag my.cnf comes from?

[root@yunlinux mysql] # rpm-qf / etc/my.cnfmariadb-libs-5.5.56-2.el7.x86_64

Is the previous configuration file available?

It can be used, but it needs to be modified to comment out the log-error and pid-file under datadir=/data/mysql socket=/tmp/msyql.sock mysqld_safe, without using it;! includedir is also commented out, neither.

Cp support-files/mysql.server / etc/init.d/mysqld

Startup script, which needs to be copied to the / etc/init.d/ directory

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

Vi / etc/init.d/mysqld

Define basedir and datadir

Others need not be modified, save and exit.

The permission of # file requires 755 [root@yunlinux mysql] # ls-l / etc/init.d/mysqld-rwxr-xr-x. 1 root root 10592 December 15 00:21 / etc/init.d/mysqld# if you need to boot, add mysqld to the service list [root@yunlinux mysql] # chkconfig-- add mysqld

View a list of services that contain mysqld

/ etc/init.d/mysqld start

[root@yunlinux mysql] # / etc/init.d/mysqld startStarting MySQL.Logging to'/ data/mysql/yunlinux.err'.. SUCCESS! # indicates that the startup is successful

Check the progress, and command ps aux | grep mysql

Check the listening port and command netstat-lntp

Service mysqld stop out of service

If you don't have a startup script for init.d, you can start it on the command line:

/ usr/local/mysql/bin/mysqld_safe-- defaults-file=/etc/my.cnf-- user=mysql-- datadir=/data/mysql & # & throw the symbol in the background # specify the path where the configuration file is located

Check to see if there is a process

Run as a command line, how to turn it off?

You must kill the process with the killall command and compare the installation. The killall command finishes executing the program before killing the process. If killall waits for a long time but does not kill it, it means that there is a large amount of data and needs to be written to disk and killed slowly. If forced kill, it may result in data loss or table corruption.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report