Compile install and binary install MySQL

Source: Internet
Author: User
Tags iptables


Useradd-r-s/sbin/nologin-m MySQL


Mkdir-p/opt/data/var


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


/etc/init.d/iptables stop


Chkconfig iptables off


Sed-i ' S#selinux=enforcing#selinux=disabled#g '/etc/selinux/config


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


CMake \

-dcmake_install_prefix=/opt/data/mysql \

-dmysql_datadir=/opt/data/var \

-DSYSCONFDIR=/ETC \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr=/tmp/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


Make && make install


Chown-r mysql:mysql/opt/data/


Mv/etc/my.cnf/etc/my.cnf.bak


scripts/mysql_install_db--basedir=/opt/data/mysql/--datadir=/opt/data/var/--user=mysql #初始化


Bin/mysqld_safe--user=mysql & #启动


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

Chkconfig Mysql.server on

Service MySQL Start--start MySQL


Echo ' Path=/opt/data/mysql/bin: $PATH ' >>/etc/profile

echo ' Export PATH ' >>/etc/profile

Source/etc/profile


mysqladmin-u root Password "Medlinker"


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: 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.


After updating the system with Yum Update, you need to check if there is a my.cnf in the/etc directory, and if so, rename it to something else. Otherwise, MySQL will start with this configuration file, which may cause problems such as an inability to start properly.




server_id = 223

Log-bin=mysql-bin


Grant Replication Slave on * * to ' backup ' @ ' 192.168.1.224 ' identified by ' medlinker ';


Show master status;


Change Master to master_host= ' 192.168.1.223 ', master_user= ' backup ', master_password= ' medlinker ', master_log_file= ' Mysql-bin.000002 ', master_log_pos=120;


Start slave;

Show Slave Status\g


Authorized Development uses:

Grant all on * * to ' root ' @ '% ' identified by ' medlinker ';


Binary installation MySQL 5.6

Tar XF mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz


LN-SV mysql-5.6.29-linux-glibc2.5-x86_64 MySQL


Useradd-r-s/sbin/nologin-m MySQL


Chown Mysql.mysql Mysql-5.6.29-linux-glibc2.5-x86_64-r


CD scripts/


./mysql_install_db--basedir=/opt/mysql--datadir=/opt/mysql/data/--user=mysql


./bin/mysqld_safe--DEFAULTS-FILE=MY.CNF &


Netstat-tnulp

Binary installation MySQL 5.7

shell> Groupadd MySQL

Shell> Useradd-r-G mysql-s/bin/false MySQL

Shell> cd/usr/local

Shell> Tar zxvf/path/to/mysql-version-os.tar.gz

shell> ln-s Full-path-to-mysql-version-os MySQL

shell> CD MySQL

shell> mkdir Mysql-files

shell> chmod 770 Mysql-files

Shell> chown-r MySQL.

Shell> chgrp-r MySQL.

Shell> bin/mysql_install_db--user=mysql # before MySQL 5.7.6

shell> bin/mysqld--initialize--user=mysql # mysql 5.7.6 and up

shell> bin/mysql_ssl_rsa_setup # mysql 5.7.6 and up

Shell> chown-r Root.

shell> chown-r MySQL Data mysql-files

Shell> Bin/mysqld_safe--user=mysql &



Initialize database, note password

./bin/mysqld--initialize--basedir=/opt/mysql7/--datadir=/opt/mysql7/data/--user=mysql

./bin/mysqld_safe--user=mysql &


#./bin/mysqladmin-u root-p Password "WQH"


mysql> alter user ' root ' @ ' localhost ' identified by ' MySQL ';

mysql> flush Privileges;




Compile install and binary install MySQL

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.