Lamp Compile and install (ii)--Install Mariadb-5.5.45

Source: Internet
Author: User
Tags mysql client php server

Background introduction

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/89/96/wKioL1gXYvviIq18AACI6-JB-zA284.png "title=" 1.png " Style= "Float:none;" alt= "Wkiol1gxyvviiq18aaci6-jb-za284.png"/>

From the previous article, we learned that when the server schema is a type in, the PHP server initiates the PHP-FPM service to listen on a specific socket to wait for the HTTPD server's request, if the request contains access to the back-end MySQL server, there are several situations:

1.PHP server is a stand-alone server, or PHP server and httpd server in the same host, and as a module of the HTTPD server exist, and are compiled and installed, the compile time needs to contact the backend MySQL server through the MYSQLND parameter

The 2.PHP server is a standalone server and is not compiled and installed, you may need to install the Php-mysql client to connect to the MySQL database

3.PHP server and MySQL share a host, you need to specify the path of MySQL when compiling and installing

It can be seen that the PHP server itself does not initiate access to the MySQL server, PHP is only working in httpd and MySQL intermediate link, it is recommended to configure the httpd and MySQL server, Then configure the PHP server (if the PHP server is not a separate host, but with httpd or MySQL shared a host, you must follow this order) the following is a binary program Mariadb-5.5.45 to demonstrate the installation of the database.

Installing Mariadb-5.5.45

1. Unzip the Mariadb-5.5.45

TAR-XF mariadb-5.5.45-linux-i686.tar.gz-c/usr/local/

2. Create a soft connection

Cd/usr/local

LN-SV Mariadb-5.5.45-linux-i686/mysql

3. Create MySQL Users and groups

Grouppadd-r MySQL

Useradd-r-m-g mysql-s/sbin/nologin MySQL

4. Change the genus/usr/local/mysql to Root:mysql

Chown-r Root:mysql/usr/local/mysql

5. Create the directory where the database files are stored/data/mydata, the main group is changed to MySQL

Mkdir-p/data/mydata

Chown-r Mysql:mysql/data/mydata

6. Output a binary file

vim/etc/profile.d/mysql.sh

Add content: Export Path=/usr/local/mysql/bin: $PATH Save exit

source/etc/profile.d/mysql.sh

7. Header file Export

ln-sv/usr/local/mysql/include/mysql//usr/include/mysql

8. library file Export

echo "/usr/local/mysql/lib/" >/etc/ld.so.conf.d/mysql.conf

See libmysql.so.18 loaded into memory description, library file exported successfully 650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M01/89/98/ Wkiom1gxyvzdh5szaaa1xy_leoc128.png "title=" 2.png "style=" Float:none; "alt=" wkiom1gxyvzdh5szaaa1xy_leoc128.png "/ >

9.man Document Export

vim/etc/man.config650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M02/89/96/ Wkiol1gxyvzbeub4aaa1-zycrki678.png "title=" 3.png "style=" Float:none; "alt=" wkiol1gxyvzbeub4aaa1-zycrki678.png "/ >

Get and modify the MARIADB configuration file

mariadb in the/usr/local/mysql/support-files directory asked us to provide a variety of hardware specifications of the configuration file, here my-large.cnf as an example, It is important to note that :/etc/my.cnf files already exist after the binaries have been extracted, and MARIADB's configuration file is:/etc/my.cnf-->/etc/mysql/my.cnf-to-~/.my.cnf

Cp/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf

VIM/ETC/MY.CNF #指明数据存放的位置650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M01/89/96/ Wkiol1gxyvybznxdaaatkyf49aa872.png "title=" 4.png "style=" Float:none; "alt=" wkiol1gxyvybznxdaaatkyf49aa872.png "/ >

To provide a startup script

Also in the/usr/local/mysql/support-files directory MARIADB provides us with a startup script

CP Mysql.server/etc/rc.d/init.d/mysqld

Chkconfig--add mysqld

Chkconfig mysqld on

Chkconfig--list | grep mysqld650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/89/98/wKiom1gXYv3DumL5AAAbFIZRS2M750.png " Title= "5.png" style= "Float:none;" alt= "Wkiom1gxyv3duml5aaabfizrs2m750.png"/>

Initializing the database

Cd/usr/local/mysql

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

Service MYSQL.D on

Then look at the/data/mydata directory, see the log file, PID file and then use NETSTAT-NTL to see if the 3306 port is listening, to determine whether the service starts normally 650) this.width=650; "src=" http:/ S4.51cto.com/wyfs02/m02/89/98/wkiom1gxyv3cywktaaa2krgadtu051.png "title=" 6.png "style=" Float:none; "alt=" Wkiom1gxyv3cywktaaa2krgadtu051.png "/>

Here are the areas to note:

1. If the binary program initializes the database into the Scripts directory execution program will have problems 650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M00/89/96/ Wkiol1gxyv3jtpifaabhz7y8yio040.png "title=" 7.png "style=" Float:none; "alt=" wkiol1gxyv3jtpifaabhz7y8yio040.png "/ >

2. According to the settings in the/ETC/MY.CNF configuration file, the socket file location is in the/tmp directory, if it is only for the local service, the service needs of the applicant to indicate the location of the socket file 650) this.width=650; "src=" http:/ S4.51cto.com/wyfs02/m01/89/98/wkiom1gxyv6bl78raaazusnikje570.png "title=" 8.png "style=" Float:none; "alt=" Wkiom1gxyv6bl78raaazusnikje570.png "/>

Test mariadb, Delete anonymous users

1. Use the MySQL command to see if it can be normal 650) this.width=650; "Src=" http://s1.51cto.com/wyfs02/M02/89/96/ Wkiol1gxyv7d1afjaabbrhgejce672.png "title=" 9.png "style=" Float:none; "alt=" wkiol1gxyv7d1afjaabbrhgejce672.png "/ >

2.use MySQL; #使用mysql库

3.SELECT User,host,password from user; #查看当前都有哪些用户650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M00/89/98/ Wkiom1gxyv-jzh8caaaz_8g1kac145.png "title=" 10.png "style=" Float:none; "alt=" wkiom1gxyv-jzh8caaaz_8g1kac145.png "/ >

4. Delete the anonymous user ( the MySQL directive is case-insensitive , which is customarily capitalized) 650) this.width=650; "Src=" http://s2.51cto.com/wyfs02/M00/89/96/wKioL1gXYv_ Da8twaabriid43mq184.png "title=" 11.png "style=" Float:none; alt= "Wkiol1gxyv_da8twaabriid43mq184.png"/>

5. Change password to root account 650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/98/wKiom1gXYv-wdWP-AABgSZtTaQ4446.png " Title= "12.png" style= "Float:none;" alt= "Wkiom1gxyv-wdwp-aabgszttaq4446.png"/>

You can also not add the host limit to modify all root password at one time, this operation completes 650) this.width=650; "Src=" http://s2.51cto.com/wyfs02/M01/89/96/ Wkiol1gxywciwnrbaab2wrglqu0402.png "title=" 13.png "style=" Float:none; "alt=" wkiol1gxywciwnrbaab2wrglqu0402.png "/ >




This article from "Rabbit-like rabbit sen Broken" blog, please be sure to keep this source http://arkling.blog.51cto.com/2844506/1867878

Lamp Compile and install (ii)--Install Mariadb-5.5.45

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.