CentOS 6.5 Source code compilation install MySQL 5.6

Source: Internet
Author: User
Tags mysql login

For the server environment, the personal feel or source code compiled installation is very reliable, if there is a server to change, directly RM out of the installation directory can be. Some people prefer Yum installation, but when you uninstall Yum Remove, you accidentally uninstall a base library, which causes the system's shell command to fail, and the scenario may be problematic even if the system starts.

1. Some necessary base libraries for the installation of the system

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

2. Add MySQL user, and restrict MySQL login, just use as service user

#新增用户组groupadd mysql# New User useradd mysql-g mysql-s/sbin/nologin

3. Building the Database base directory

#创建数据库执行文件目录mkdir-P/data/mysql-5.6/data/#创建数据库文件目录mkdir-P/data/mysql-5.6# Modify the directory owner Chown-r mysql:mysql/data/ Mysql-5.6/data/chown-r mysql:mysql/data/mysql-5.6chown-r mysql:mysql/data/mysql-5.6/data/.chown-r mysql:mysql/ data/mysql-5.6/.

4. Compiling the installation

 vi /etc/profile  #在该文件的末尾, add  path variable  path=/data/mysql-5.6/bin:/data/mysql-5.6/lib:$ path export path   #让配置的path变量生效  source /etc/profile   #安装编译源码所需的工具和库  yum -y install wget gcc-c++ ncurses-devel cmake make perl    #进入压缩包目录解压并且编译  cd /data/src/mysql-5.6.10 cmake -dcmake_install_prefix=/data/ Mysql-5.6 -dmysql_unix_addr=/data/mysql-5.6/tmp/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=/data/mysql-5.6/data -dmysql_ user=mysql -dmysql_tcp_port=3339-denable_downloads=1  (appears googlemock was not found.   Plus)-dwith_debug=0# compile and install Make &amp& make install# Copy the boot file so that it can be started in the way of direct services, boot from boot, etc... cp -ar /data/mysql-5.6/support-files/mysql.server /etc/init.d/mysqld# install the database./scripts/mysql_ install_db --user=mysql --datadir=/data/mysql-5.6/data/#  Copying a configuration file cp -ar /data/mysql-5.6 /support-files/my-default.cnf  /etc/my.cnf# Edit the/ETC/MY.CNF, modify the base path, or the startup error will occur. Because we are compiling the default installation directory and configuration file directory, and so on. [mysqld]datadir=/data/mysql-5.6/data/socket=/data/mysql-5.6/tmp/mysql.sockuser=mysql# disabling  symbolic-links is recommended to prevent assorted security  riskssymbolic-links=0[mysqld_safe]log-error=/data/log/mysqld.logpid-file=/data/mysql-5.6/tmp/mysqld.pid# Start the MYSQLD service/etc/init.d/mysqld start

Here, our MySQL source code compilation has been installed successfully, below we need to do some security settings for the database.

    1. Delete the test database for the data.

[[Email protected] tmp]# mysql -urootwelcome to the mysql monitor.   commands end with ; or \g.your mysql connection id is  1Server version: 5.6.10 Source distributionCopyright  (c)  2000, 2013,  oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or  Itsaffiliates. other names may be trademarks of their respectiveowners . type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statement.mysql> mysql> show databases;+--------------------+| database            |+--------------------+| information_schema  | |  mysql              | |  performance_schema | |  test               |+-------- ------------+4 rows in set  (0.00 sec) mysql> drop database test; query ok, 0 rows affected  (0.00 SEC)

2. Modify access permissions for the database.

mysql> select user,password,host from mysql.user;+------+----------+------------------- ----+| user | password | host                   |+------+----------+-----------------------+| root  |          | localhost              | |  root |          | ay140718141902043917z  | |  root |          | 127.0.0.1              | |  root |          | ::1                    | |       |          | localhost              | |       |          |  ay140718141902043917z |+------+----------+-----------------------+6 rows in set  (0.00  SEC) #删除空的账户mysql > delete from mysql.user where user= "; query ok, 2 rows affected  (0.00 sec) #创建授权账户mysql > grant all  privileges on aisk.*  ' Tomer ' @ ' 10.% '  indentified by  ' Hjyk '  with grant  option;



















This article is from the "-= lake-side Bamboo =-" blog, please be sure to keep this source http://bronte.blog.51cto.com/2418552/1441182

CentOS 6.5 Source code compilation install MySQL 5.6

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.