CentOS Installation mysql5.6

Source: Internet
Author: User
Tags mysql version iptables automake

Reprinted from Http://www.cnblogs.com/littlehb/archive/2013/04/02/2995007.html

Mysql 5.5 After using the CMake for installation, reference and previous differences please refer to:

Http://www.blogjava.net/kelly859/archive/2012/09/04/387005.html

Connect to the above.

1: Download: current MySQL version to 5.6.17

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz

2: Necessary Packages

Yum-y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* Mak E CMake Bison Bison-devel


# New User Groups
Groupadd MySQL

# New users
Useradd mysql-g MySQL

# New Database Execution file directory
Mkdir-p/usr/local/mysql

# New Database Data file directory
Mkdir-p/db/mysql/data

# Modify Directory Owner

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

Chown-r Mysql:mysql/db/mysql/data

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

Chown-r mysql:mysql/db/mysql/data/.

# Edit Path Search paths
Vi/etc/profile
Add the following two lines:


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

# Valid Path search path
Source/etc/profile

# Install the tools and libraries needed to compile the source code
Yum-y install wget gcc-c++ ncurses-devel cmake make Perl

# Enter the source tarball download directory
Cd/usr/src

# Download the source Zip package
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz

# Unzip the source package
Tar-zxv-f mysql-5.6.17.tar.gz

# Go to Unzip source directory

CD mysql-5.6.17

# Compile and install

Copy Code

CMake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/usr/local/mysql/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/db/mysql/data \
-dmysql_user=mysql \
-dmysql_tcp_port=3306


-denable_downloads=1 (appears Googlemock was not found. Plus)

-dwith_debug=0


Make && make install

The red section indicates that debug mode is disabled.
Copy Code
# Copy configuration file
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf

# Enter the installation path
Cd/usr/local/mysql

# Execute configuration Script
scripts/mysql_install_db--user=mysql--datadir=/db/mysql/data

# Copy Service startup script
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

# Start the MySQL service
Service MySQL Start

# Set up auto start service on boot
Chkconfig MySQL on

#添加系统变量

echo "Path=/usr/local/mysql/bin:/usr/local/mysql/lib:\ $PATH" >>/etc/profile
echo "Export PATH" >>/etc/profile
Source/etc/profile

>>>>>>>>>>>>>>> completion

If the following error occurs:

[[Email protected] mysql]# service MySQL restart
MySQL server PID file could not being found! Failed
Starting MySQL ... The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid). Failed

The solution to the problem in the Yellow Sea is:

Killall command

The killall command kills all processes within the same process group. It allows you to specify the name of the process to terminate, not the PID.

# Killall Mysqld

Review the MYSQLD process again:

Ps-ef|grep mysqld

Without! The world is quiet.

Running MySQL

Then enter the status after entering the mysql> prompt;

View the installation situation.

Copy Code
mysql> status;
--------------
MySQL Ver 14.14 distrib 5.6.10, for Linux (x86_64) using Editline Wrapper

Connection id:1
Current database:
Current User: [email protected]
Ssl:not in use
Current Pager:stdout
Using outfile: '
Using delimiter:;
Server version:5.6.10 Source Distribution
Protocol version:10
Connection:localhost via UNIX socket
Server characterset:latin1
Db characterset:latin1
Client characterset:latin1
Conn. Characterset:latin1
UNIX Sockets:/tmp/mysql.sock
Uptime:7 sec

Threads:1 questions:5 Slow queries:0 opens:67 Flush tables:1 Open tables:60 queries per second avg:0.714
--------------
Copy Code
#表名全部为小写, to avoid case sensitivity

VI/ETC/MY.CNF Add the following to resolve the case table name sensitivity issue.

Lower_case_table_names=1

Modify the password of the root user of MySQL and open the remote connection

Mysql

mysql> use MySQL;

Copy Code
mysql> desc User;

Mysql> GRANT All privileges on * * to [email protected] '% ' identified by ' root '; The ability to add remote connections for root
mysql> Update user Set Password = Password (' 123456 ') where user= ' root '; Set the root user password

Mysql> Select Host,user,password from User where user= ' root ';

mysql> flush Privileges;

Mysql> exit
Copy Code

The following automatic installation scripts are included:

VI installmysql.sh

chmod 777 installmysql.sh

./installmysql.sh

The contents are as follows:

Copy Code
Yum-y install wget gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* Make CMake Perl bison bison-devel

Groupadd MySQL
Useradd mysql-g MySQL
Mkdir-p/usr/local/mysql
Mkdir-p/db/mysql/data

Chown-r Mysql:mysql/usr/local/mysql
Chown-r Mysql:mysql/db/mysql/data
Chown-r mysql:mysql/usr/local/mysql/.
Chown-r mysql:mysql/db/mysql/data/.

echo "Path=/usr/local/mysql/bin:/usr/local/mysql/lib:\ $PATH" >>/etc/profile
echo "Export PATH" >>/etc/profile

Source/etc/profile

Cd/usr/software/
#下载mysql源码包
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
TAR-ZXVF mysql-5.6.17.tar.gz
cd/usr/software/mysql-5.6.17
cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/usr/local/mysql/mysql.sock-ddefault_charset= Utf8-ddefault_collation=utf8_general_ci-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_ Archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1- denabled_local_infile=1-dmysql_datadir=/db/mysql/data-dmysql_user=mysql-dmysql_tcp_port=3306
Make && make install

Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Cd/usr/local/mysql
scripts/mysql_install_db--user=mysql--datadir=/db/mysql/data
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

echo "Lower_case_table_names=1" >>/etc/my.cnf

Service MySQL Start
Chkconfig MySQL on

mysqladmin-u root password ' dsideal '

Service Iptables Stop
Chkconfig iptables off

Sed-i ' s#selinux=enforcing#selinux=disabled# ' G/etc/sysconfig/selinux

CentOS Installation mysql5.6

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.