Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Source package compilation and installation of MySQL 5.6script

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The source package compiles and installs the MySQL5.6 script, one machine installs two MySQL databases, and specifies the port, installation path and socket file location at compile time.

The installed MySQL installation files can be packaged and copied to other machines, which only need to be initialized when other machines are used, and you can give relevant directory permissions.

Install MySQL for port 3306:

#! / bin/bash

Groupadd mysql

Useradd-g mysql mysql-s / sbin/nologin

Mkdir / data/3306

Chown-R mysql.mysql / data/3306

Chmod 755 / data/3306

# mount-o loop / tmp/turbolinux12.iso / mnt/

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

Tar zxf / tmp/mysql-5.6.16.tar.gz-C / usr/local/src/

Mv / usr/local/src/mysql-5.6.16/ / usr/local/src/mysql-master

# read-n1 var press any key to continue

Read-N1 var

Cd / usr/local/src/mysql-master

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-master/\

-DMYSQL_DATADIR=/data/3306/data\

-DMYSQL_TCP_PORT=3306\

-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysql-master.sock\

-DSYSCONFDIR=/usr/local/mysql-master\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DWITH_EXTRA_CHARSETS=ALL\

-DMYSQL_USER=mysql

Read-N1 var

Make

Read-N1 var

Make install

Read-N1 var

Chown-R mysql.mysql / usr/local/mysql-master

/ usr/local/mysql-master/scripts/mysql_install_db-basedir=/usr/local/mysql-master-datadir=/data/3306/data-user=mysql

Cp / usr/local/mysql-master/support-files/mysql.server / etc/init.d/mysqld-master

Read-N1 var

Chmod + x / etc/init.d/mysqld-master

Chkconfig-add mysqld-master

Chkconfig mysqld-master on

/ etc/init.d/mysqld-master start

Install mysql for port 3307:

#! / bin/bash

Groupadd mysql

Useradd-g mysql mysql-s / sbin/nologin

Mkdir / data/3307

Chown-R mysql.mysql / data/3307

Chmod 755 / data/3307

# mount-o loop / tmp/turbolinux12.iso / mnt/

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

Tar zxf / tmp/mysql-5.6.16.tar.gz-C / usr/local/src/

Mv / usr/local/src/mysql-5.6.16/ / usr/local/src/mysql-slave

Read-N1 var

Cd / usr/local/src/mysql-slave

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-slave/\

-DMYSQL_DATADIR=/data/3307/data\

-DMYSQL_TCP_PORT=3307\

-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysql-slave.sock\

-DSYSCONFDIR=/usr/local/mysql-slave\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DWITH_EXTRA_CHARSETS=ALL\

-DMYSQL_USER=mysql

Read-N1 var

Make

Read-N1 var

Make install

Read-N1 var

Chown-R mysql.mysql / usr/local/mysql-slave

/ usr/local/mysql-slave/scripts/mysql_install_db-basedir=/usr/local/mysql-slave-datadir=/data/3307/data-user=mysql

Cp / usr/local/mysql-slave/support-files/mysql.server / etc/init.d/mysqld-slave

Read-N1 var

Chmod + x / etc/init.d/mysqld-slave

Chkconfig-add mysqld-slave

Chkconfig mysqld-slave on

/ etc/init.d/mysqld-slave start

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report