CentOS 6.5 Under compile install MySQL 5.6.20

Source: Internet
Author: User
Tags iptables

Overview:
In Centos 6.5, the installation of MySQL via Yum is version 5.1, older, so you want to install the high version of 5.6.20 via source code.

Body:
One: Uninstall the old version
Use the following command to check if MySQL Server is installed

Rpm-qa | grep MySQL Some words by the following command to uninstall off

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, You can use this command to delete the two: install MySQL
Install the required package for compiling code
yum-y install make gcc-c++ cmake bison-devel  ncurses-devel download MySQL 5.6.14
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz
Tar xvf mysql-5.6.20.tar.gz
CD mysql-5.6.20 Compile and install
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_archive_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-DWITH_ blackhole_storage_engine=1 \
-dwith_readline=1 \
-denable_downloads=1 \
-denabled_local_infile=1 \
- Dmysql_unix_addr=/var/lib/mysql/mysql.sock \
-dmysql_tcp_port=3306 \
-dextra_charsets=all \
-DDEFAULT_ Charset=utf8 \
-ddefault_collation=utf8_general_ci

The parameters for the build && make install are referenced in http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html.

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

Three: Configure 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 View user Groups list if not, create a

Groupadd MySQL
useradd-g mysql mysql modify/usr/local/mysql permissions

Chown-r mysql:mysql/usr/local/mysql Modify/usr/local/mysql permissions

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 you start 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 of the new MySQL configuration file! Note: After the minimum installation of the CentOS version 6.4 operating system, there will be a my.cnf in the/etc directory, which will need to be renamed to a different name, such as:/etc/ My.cnf.bak, otherwise, the file will interfere with the correct configuration of the source installed MySQL, resulting in the inability to start.

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 configuration user
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 closes the file and runs the following command to make 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 remotely access, execute

Mysql> GRANT All privileges on * * to ' root ' @ ' 172.16.% ' identified by ' password ' with GRANT OPTION; Red password for remote access, RO OT user's password, can be different from 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 to refresh the firewall configuration:

Service iptables Restart OK, everything is configured, you can access your MySQL ~


This article is from the "Shiningliliang" blog, make sure to keep this source http://shiningliliang.blog.51cto.com/4984800/1574088

CentOS 6.5 Under compile install MySQL 5.6.20

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.