LNMP Build 01--Compile and install MySQL 5.6.14 and LNMP related differences

Source: Internet
Author: User
Tags curl mysql in openssl iptables openldap

the Compile installation MySQL 5.6.14 "

" http://www.cnblogs.com/xiongpq/p/3384681.html "

"mysql-5.6.14.tar.gz Download" http://pan.baidu.com/s/1jGIffFo

One: Uninstall the old version

Use the following command to check if MySQL is installed, and if the initial installation is skipped directly.

Rpm-qa | grep MySQL

Some words are unloaded by the following command

In fact, it is very simple, directly delete the compiled installation directory, for example:/usr/local/mysql.

RPM-E MySQL//normal Delete mode

RPM-E--nodeps MySQL//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted

Two: Installation MySQL

Install packages required for compiling code

Yum-y install make gcc-c++ cmake bison-devel ncurses-devel

Download MySQL 5.6.14

TAR-ZXVF mysql-5.6.14.tar.gz

CD mysql-5.6.14

Compiling the installation

CMake \

-dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/usr/local/mysql/data \

-DSYSCONFDIR=/ETC \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr=/var/lib/mysql/mysql.sock \

-dmysql_tcp_port=3306 \

-denabled_local_infile=1 \

-dwith_partition_storage_engine=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci

Then execute:

Make && make install

The compiled parameters can refer to http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html.

The whole process takes about 30 minutes ... A long wait

Three: Configuration MySQL

Set permissions

Use the following command to see if there are MySQL users and user groups

CAT/ETC/PASSWD View the list of users

Cat/etc/group viewing a list of user groups

If not, create

Groupadd MySQL

useradd-g MySQL MySQL

Modify/usr/local/mysql Permissions

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

Initialize configuration

Go to installation path

Cd/usr/local/mysql

Enter the installation path, execute the initialization configuration script, create the system's own database and table

scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql

Note: When starting the MySQL service, will be in a certain order to search my.cnf, first in the/etc directory, find will search "$basedir/my.cnf", in this case is/usr/local/mysql/ MY.CNF, this is the default location for the new MySQL configuration file!

Note: in CentOS 6.4 version of the operating system, after the minimum installation is complete, / etc directory, there will be a my.cnf , you need to rename this file to another name, such as: /etc/my.cnf.bak , otherwise the file will interfere with the source installation MySQL the correct configuration, causing the failure to start. After updating the system with Yum Update, you need to check if there is an extra my.cnf in the/ etc Directory , if it is more, rename it to something else. Otherwise,MySQL will start with this configuration file, which may cause problems such as an inability to start properly.

Start MySQL

Add services, Copy service scripts to the INIT.D directory, and set boot boot

CP Support-files/mysql.server/etc/init.d/mysql

Chkconfig MySQL on

Service MySQL Start--start MySQL

Configure users

After MySQL starts successfully, Root does not have a password, we need to set the root password.

Before setting, we need to set path, or we can't call MySQL directly

Modify the/etc/profile file to add at the end of the file

Path=/usr/local/mysql/bin: $PATH

Export PATH

Close the file, run the following command, and let the configuration take effect immediately

Source/etc/profile

Now, we can enter MySQL in the terminal directly into the MySQL environment

Execute the following command to modify the root password

Mysql-uroot

mysql> SET PASSWORD = PASSWORD (' 123456 ');

To set the root user to have remote access, perform

Mysql> GRANT All privileges on * * to ' root ' @ ' 172.16.% ' identified by ' 123456 ' with GRANT OPTION;

When the red password is remote access, the root user's password can be different from the local.

Configuring firewalls

Firewall 3306 port is not enabled by default, to remote access, you need to open this port

Open/etc/sysconfig/iptables

Under "-A input–m State--state new–m tcp–p–dport 22–j ACCEPT", add:

-A input-m state--state new-m tcp-p-dport 3306-j ACCEPT

Then save and close the file, run the following command in the terminal and refresh the firewall configuration:

Service Iptables Restart

OK, all configured, you can access your MySQL ~

--------------------------------------------------------------------------------------------------------------- ---

December 02, 2014 added:

FIREWALLD is used as a firewall by default in CentOS 7, so after modifying iptables, it doesn't work after rebooting the system.

The Add port method in Firewalld is as follows:

Firewall-cmd--zone=public--add-port=3306/tcp--permanent

Firewall-cmd--reload


Xiongpq
Source: http://xiongpq.cnblogs.com/
This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

Category: Server technology

Tags: Linux, MySQL

"The main difference between the CentOS compiler Lnmp and Ubuntu"

"What to do before CentOS compiles nginx"
Yum Install gcc gcc-c++ kernel-devel
Yum-y Install Pcre-devel OpenSSL openssl-devel
------------------------------------------------------
"What to do before CentOS compiles PHP"
Yum install-y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freety Pe-devel libxml2libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncursesncurses-devel Curl Curl-devel E2fsprogs e2fsprogs-devel krb5 krb5-devel opensslopenssl-devel openldap openldap-devel nss_ldap openldap-clients Openldap-servers
------------------------------------------------------
The rest is the same as the Ubuntu operation.



LNMP Build 01--Compile and install MySQL 5.6.14 and LNMP related differences

Related Article

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.