Centos-6.4-minimal version of the source installation MySQL-5.5.38

Source: Internet
Author: User
Tags iptables

/** * Centos-6.4-minimal version of the source installation MySQL-5.5.38 *---------------------------------------------------------------------- ------------------------------------------------* Three ways to install * 1) Source installation * 2) binary Package installation * 3) RPM or Yum installation * This article demonstrates the source installation, and, starting from mysql-5.5 , the source installation to be installed through CMAKE, no longer like the previous use of configure installed * We in the mysql-5.5.38.tar.gz root directory, you will see a file called "Build-cmake", open can see the following words * what do you Need:cmake version 2.6 or later installed on your system. * -------------------------------------------------------------------------------------------------------------- --------* Install CMake (cross platform make) * CMake is independent of the source code compilation, the compilation work can be in another directory rather than the source directory, the advantage is to ensure that the source directory is not affected by any compilation * CMake installation method See Official document http://www.cmake.org/install/, we go to http://www.cmake.org/download/download cmake-3.0.2.tar.gz * [email  protected] software]# cmake-version #我们会发现没有输出, stating that the machine is not installed CMake * [[email protected] software]# Yum list CMake--showduplicates #查看yum可安装的软件包版本, will see only install CMAKE-2.6.4-5.EL6 version, so discard * [[email protected] software]# Yum-y Install GCC gcc-c++ #安装必要的编译环境 * [[[email protected] software]# yum-y install autoconf libtool #安装必要的编译环境 * [[email protected ] software]# yum-y Install Ncurses-devel #安装必要的编译环境 (this is the library to use when configuring the MySQL environment variable, installed here) * [[email protected] software]# t Ar zxvf cmake-3.0.2.tar.gz #解压cmake -3.0.2 Source * [[email protected] software]# CD cmake-3.0.2 #进入cm  ake-3.0.2 Source Directory * [[email protected] cmake-3.0.2]#./bootstrap #成功时, will prompt CMake has bootstrapped. Now run Gmake. * [[email protected] cmake-3.0.2]# gmake #执行编译 * [[email protected] cmake-3.0.2]# gmake i Nstall #执行安装 * [[email protected] cmake-3.0.2]# CD ~ #退出cmake -3.0.2 Source directory * [[EM Ail protected] ~]# rm-rf/app/software/cmake-3.2.0* #删除cmake -3.0.2 Source * [[email protected] ~]# Cmake-versi On #验证cmake -3.0.2 Installation results *-------------------------------------------------------------------------- --------------------------------------------* @create Sep, 5:47:18 PM * @author Xuan Yu 
/** * ----------------------------------------------------------------------------------------------------------- -----------* Install mysql * [[[email protected] ~]# groupadd-r mysql * [[email protected] ~]# useradd-r-s/sbin/no login-g MySQL MySQL * [[email protected] ~]# mkdir-pv/app/mysql * [[email protected] ~]# Mkdir-pv/app/mysql _data * [[email protected] ~]# chown-r mysql.mysql/app/mysql_data * [[email protected] ~]# tar zxvf/app/softw are/mysql-5.5.38.tar.gz * [[email protected] ~]# CD mysql-5.5.38/* [[email protected] mysql-5.5.38]# cmake. -dcmake_install_prefix=/app/mysql-dmysql_datadir=/app/mysql_data-dsysconfdir=/etc-dwith_innobase_storage_ Engine=1-dwith_myisam_storage_engine=1-dwith_readline=1-dwith_zlib=system-ddefault_charset=utf8-ddefault_ COLLATION=UTF8_GENERAL_CI * [[email protected] mysql-5.5.38]# make * [[email protected] mysql-5.5.38]# make Install *----------------------------------------------------------------------------------------------------------------------* Configure MySQL * [[email protected] ~]# Cd/app/mysql /support-files/* [[email protected] support-files]# CP my-large.cnf/etc/my.conf #拷贝配置文件 * [[Email protec Ted] support-files]# CP mysql.server/etc/init.d/mysqld #拷贝启动脚本 * [[email protected] support-files]# chmod-x/etc/i Nit.d/mysqld #赋予可执行权限 * [[email protected] support-files]# chkconfig--add mysqld #加入系统服务 * [[Emai L protected] support-files]# chkconfig mysqld on #开机启动 * [[email protected] support-files]# vi/e tc/profile.d/mysql.sh #手动创建, add content to [Export path= $PATH:/app/mysql/bin] * [[email protected] support-files]# Sour ce/etc/profile.d/mysql.sh #执行一遍 * [[email protected] support-files]# echo $PATH #查看结果 * [[email protected] support-files]# cd/app/mysql #进入MySQL主目录 * [[email protected] mysql]# b  In/mysql_secure_installation            #会提示设置root密码, whether to remove anonymous users, whether to disable root telnet, and so on *----------------------------------------------------------------------- -----------------------------------------------* Modify configuration file/etc/my.cnf * Add or modify the following properties under [mysqld] * user = MySQL * bas Edir =/app/mysql * DataDir =/app/mysql_data * pid-file =/app/mysql_data/mysqld.pid * Ft_min_word _len = 4 * max_allowed_packet = 32M * character-set-server = Urf8 * Skip-name-resolve *---------------------------------- ------------------------------------------------------------------------------------* Initialize MySQL * [[email  Protected] ~]#/app/mysql/scripts/mysql_install_db--basedir=/app/mysql--datadir=/app/mysql_data--user=mysql *---- --------------------------------------------------------------------------------------------------------------- ---* Start mysql * [[[email protected] ~]# service mysqld start * [[email protected] ~]# Netstat-tlanop | grep:3306 * [[email protected] ~]# Mysql-uroot-phongYu *------------------------------------------------------------------------------------------------------------ ----------* @create Sep, 11:04:27 AM * @author Xuan Yu 
/** * ----------------------------------------------------------------------------------------------------------- -----------* Precautions * 1) when installing the necessary compilation environment, you can also use the [um-y groupinstall "Development tools"] command, but this will install about 101 libraries, too rough, not recommended * 2) Useradd-s/SBI N/nologin * This command is used to set the added user default bash to Nologin, that is, does not allow this user to log into the system through the shell * 3)/app/mysql/directory for the MySQL database main program directory */app/mysql_data/directory for my SQL data File directory * 4) If an error occurs during cmake configuration of the environment, such as prompting Ncurses-devel not found, when Yum is install and wants to reconfigure the environment, clear the old object file and cache information * [[email  Protected] mysql-5.5.38]# Make clean * [[email protected] mysql-5.5.38]# rm-f CMakeCache.txt * [[Email prot  Ected] mysql-5.5.38]# rm-rf/etc/my.cnf * 5) When initializing MySQL, keep up with the--basedir and--datadir parameters * Otherwise it will be reported fatal error:could not due to relative path relationships Find./bin/my_print_defaults * 6) prompt to start MySQL [env:/etc/init.d/mysqld: Insufficient Permissions] * This time execution [Chmod-x/etc/init.d/mysqld] is not possible, need to execute [chmod a+wrx/etc/init.d/mysqld] * then execute [service mysqld start] to start, when the boot success will see [Starting MySQL .... Success!] * Note that this operation is the root user * 7) after installing and starting MySQL, the default does not support users through non-native client connectionsTo MySQL, the solution is as follows * [[[email protected] ~]# Mysql-uroot-phongyu * mysql> GRANT all privileges on *. * to ' root @ '% ' Identified by ' hongyu22 ' with GRANT OPTION; * Mysql> FLUSH privileges; * Mysql> exit * This way, all users can connect to MySQL, but note that the password used to connect is hongyu22, not Hongyu * where the root of [' root ' @ '% '] indicates the user name,% represents any host or IP address, can Modify the user name or host IP * According to actual needs * and, here authorization is authorized all permissions, of course, can also specify partial permissions, see Official document Http://dev.mysql.com/doc/refman/5.5/en/grant.html * 8) through the above operation, If the client is still unable to connect to MySQL, try the following * Modify the/etc/sysconfig/iptables file, add a line [-A input-m State--state new-m tcp-p TCP--dport 3306-j AC CEPT] * Then execute the [service iptables restart] command to restart the firewall, no need to restart Linux * detailed instructions see http://blog.csdn.net/jadyer/article/details/ 11324237 *------------------------------------------------------------------------------------------------------ ----------------* Compile options (see the official documentation for other parameters) *-dcmake_install_prefix=/app/mysql #数据库安装路径 (default is/usr/local/mysql), which can be used when starting a service The--basedir parameter specifies *-dinstall_plugindir=/usr/local/mysql/plugin #插件文件及配置路径 *-dmysql_datadir=/aPp/mysql_data #数据文件路径 *-dsysconfdir=/etc #配置文件路径 *-dwith_innobase_storage_engine=1             #安装InnoDB存储引擎 *-dwith_myisam_storage_engine=1 #安装MyISAM存储引擎 *-dwith_archive_storage_engine=1 #安装archive存储引擎 *-dwith_blackhole_storage_engine=1 #安装blackhole存储引擎 *-dwithout_blackhole_storage_engi                              Ne=1 #取消安装blackhole存储引擎 *-dwith_readline=1 #支持批量导入mysql数据 *-dwith_ssl=yes                          #支持SSL *-dwith_ssl=system #mysql支持ssl会话 for SSL-based data replication *-dwith_zlib=system                          #压缩库 *-dwith_libwrap=0 #是否可以基于WRAP实现访问控制 *-dmysql_user=mysql           #MySQL用户名 *-dmysql_tcp_port=3306 #MySQL监听端口 *-dmysql_unix_addr=/tmp/mysql.sock                        #指定socket文件存放位置 *-denabled_local_infile=1 #是否启用LOCAL_INFILE功能, which allows data to be imported from the local *-dextra_charsets=all #安装All extended Character Sets *-ddefault_charset=utf8 #默认编码机制 *-ddefault_collation=utf8_general_ci #默认语言的排序规则 (check Word *-dwith_debug=0 #DEBUG功能设置 *-denable_profiling=1 #是否启用性能分析功能 *-- --------------------------------------------------------------------------------------------------------------- -----* @create SEP, 11:05:06 AM * @author Xuan Yu 

Centos-6.4-minimal version of the source installation MySQL-5.5.38

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.