Linux Learning Summary (30) lamp MySQL Installation

Source: Internet
Author: User

Introduction to a lamp architecture

Lamp is Linux apache mysql php abbreviation, is the entire set of server environment, for the PHP development of the site, we access to the page or data is likely to be provided by this set of environment. For ordinary netizens, we do not pay attention to the content of the website we visit, in fact, there are two categories, one is the static data represented by the image, a kind of data stored in the database, such as the user name password we log in the blog. According to the principle of decomposition, Linux of course refers to our Linux operating system Centos,ubuntu and so on. Apache we all know that he is the name of a foundation, the essence of which is a Web server called httpd. MySQL is a database that is used to store dynamic data, and what really deals with him is an application called PHP. In the lamp architecture, he exists as a module of the httpd. The static files requested by the user are stored directly on the server, the dynamic data is stored in the database, passed to the web via PHP, and the database can be mounted on a separate server and connected over the network.

Two MySQL installations

Let's look at MySQL installation in detail below.
Several common installation packages for MySQL: rpm, source code, binary-free compiler package installation
Here we use the binary-free compiler package installation, he is relative to the source package does not have to solve the compilation of missing library errors, installation more simple
Single, because he was compiled in the Linux system, relative to the rpm he can specify the directory, convenient package management.
cd /usr/local/srcTo this directory, and then unify the downloaded app package here
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
Download a MySQL package, if the link fails, you can find another mirror source
tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
1 packet renaming
mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
cd /usr/local/mysql
2 Create user and data storage directory

useradd mysql  mkdir /data/   

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

We found that the missing Perl module Dumper package, we tried to find the
yum list |grep perl |grep-i dumper //-I ignore case

We can try to install both packages to see if we can solve the problem, You can also install both, and then initialize.
We yum installed the first package, once again initialized, found another problem, really frustrated, but do not fear, the Internet checked the next solution: the lack of Libaio library files, directly put a big recruit, Yum install-y libaio* Later I found that I can directly
yum povides libaio.so.1 to find this library file, after all, this fuzzy matching installation is not practical.

After the installation, echo $? The result is 0, okay.
CP support-files/my-default.cnf/etc/my.cnf
Copy the profile template and edit it, and we find that there is already a my.cnf under/etc/ Then you can not use the above my-default.cnf file, directly edit the file can be
4 edit the configuration file
vim/etc/my.cnf

We define DATADIR and sockets Then comment out other content
5 definition startup script
CP support-files/mysql.server/etc/init.d/mysqld
vim/etc/init.d/ Mysqld
Copy the startup file and edit the
define Basedir and DataDir

/etc/init.d/mysqld start
appears sucess After the boot is successful, you can PS aux |grep mysqld to view the next process.
6 To enable boot, you can

chkconfig --add mysqld    //加入系统服务列表chkconfig mysqld on

Linux Learning Summary (30) lamp MySQL Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.