centos6.5编译安装mysql5.7.11

1、安装相关依赖包

yum -y install gcc* autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libmcrypt* libtool-ltdl-devel*

2、需要安装个包

  • 安装cmake

[email protected] src]# tar zxvf cmake-2.8.5.tar.gz

[[email protected] src]# cd cmake-2.8.5

[[email protected] cmake-2.8.5]# ./bootstrap

…… ……

-- Build files have been written to: /usr/local/src/cmake-2.8.5

---------------------------------------------

CMake has bootstrapped.  Now run gmake.

[[email protected] cmake-2.8.5]# gmake

…… ……

[100%] Building CXX object Tests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o

Linking CXX executable runcompilecommands

[100%] Built target runcompilecommands

[[email protected] cmake-2.8.5]# gmake install

[[email protected] cmake-2.8.5]# cd ..

  • 安装mysql5.7.11

[[email protected] src]# groupadd mysql

[[email protected] src]# useradd -g mysql mysql

[[email protected] src]# tar zxvf mysql-5.7.11.tar.gz

[[email protected] src]# cd mysql-5.7.11

[[email protected] mysql-5.7.11]#

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=all \

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_DATADIR=/var/mysql/data \

-DMYSQL_USER=mysql \

-DDOWNLOAD_BOOST=1 \

-DWITH_BOOST=/usr/local/boost/boost_1_59_0

…… ……

CMake Warning:

Manually-specified variables were not used by the project:

MYSQL_USER

WITH_MEMORY_STORAGE_ENGINE

-- Build files have been written to: /usr/local/src/mysql-5.7.11

[[email protected] mysql-5.7.11]#make

…… ……

[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o

Linking CXX executable my_safe_process

[100%] Built target my_safe_process

[[email protected] mysql-5.7.11]#make install

…… ……

-- Installing: /usr/local/mysql/man/man1/mysql_find_rows.1

-- Installing: /usr/local/mysql/man/man1/mysql_upgrade.1

-- Installing: /usr/local/mysql/man/man1/mysqlimport.1

-- Installing: /usr/local/mysql/man/man1/mysql_client_test.1

-- Installing: /usr/local/mysql/man/man8/mysqld.8

[[email protected] mysql-5.7.11]# chmod +w /usr/local/mysql/

[[email protected] mysql-5.7.11]# chown -R mysql:mysql /usr/local/mysql/

[[email protected] mysql-5.7.11]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

[[email protected] mysql-5.7.11]# mkdir -p /var/mysql

[[email protected] mysql-5.7.11]# mkdir -p /var/mysql/log/

[[email protected] mysql-5.7.11]# chown -R mysql:mysql /var/mysql/

[[email protected] mysql-5.7.11]# cd support-files/

[[email protected] support-files]# cp my-medium.cnf /etc/my.cnf

[[email protected] support-files]# cp mysql.server /etc/init.d/mysql

[[email protected] support-files]# vim /etc/my.cnf

[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
#log_bin=mysql-bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /var/mysql/data
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
#defaults-file=/etc/my.cnf
explicit_defaults_for_timestamp=true

初始化mysql:

[[email protected] support-files]# /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/var/mysql/data

You can start the MySQL daemon with:

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!

[[email protected] support-files]# chmod +x /etc/init.d/mysql

[[email protected] support-files]# vi /etc/init.d/mysql

basedir=/usr/local/mysql

datadir=/var/mysql/data

[[email protected] support-files]#chkconfig --add mysql

[[email protected] support-files]#chkconfig --level 345 mysql on

[[email protected] support-files]# cd /usr/local/mysql

[[email protected] mysql]# service mysql start

Starting MySQL.. SUCCESS!

[[email protected] mysql]# mysql

-bash: mysql: command not found

[[email protected] mysql]# /usr/local/mysql/bin/mysql -uroot mysql

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.01 sec)

mysql> exit

Bye

[[email protected] mysql]# ln -s /usr/local/mysql/bin/mysql  /usr/bin

[[email protected] mysql]#ln -s /usr/local/mysql/bin/mysqladmin  /usr/bin

[[email protected] mysql]# mysql

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

mysql> grant all privileges on *.* to [email protected]‘%‘ identified by ‘123456‘ with grant option;

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

[[email protected] mysql]# /etc/init.d/iptables stop;

Flushing firewall rules: [  OK  ]

Setting chains to policy ACCEPT: filter [  OK  ]

Unloading iptables modules: [  OK  ]

开启端口3306的访问:

sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

service  iptables save

时间: 2024-08-05 11:16:20

centos6.5编译安装mysql5.7.11的相关文章

centos6.7编译安装mysql5.7.17

centos6.7编译安装mysql5.7.17 2017-03-24 09:57:15 提示:mysql5.7.17和之前5.56以前的版本安装不一样,需要用cmake 另外,看本文档的mysql编译前我说一点,第一次一定要大概的看完整个过程,不能一直跟着文档做,否则后面容易遇到问题.比如编译完会特别占用磁盘空间,万一之前分配的空间不够,那样就会丢失很多重要文件导致失败. 安装前工作: 1,从官方网址下载MySQL5.7.17源码包 http://dev.MySQL.com/downloads

centos6.5编译安装mysql5.6.20

一.   准备工作 1     yum安装各个依赖包 [[email protected] ~]# yum –y install gcc gcc-devel gcc-c++ gcc-c++-devel  zlib*  ncurses-devel ncurses openssl openssl-devel bison bison-devel libaio [[email protected] ~]# yum –y install cmake 2.新建mysql组和用户 [[email protec

CentOS6.9编译安装MySQL5.7.16

部署环境: 系统CentOS6.9,mysql5.7.16,boost库 系统为2G内存 1.安装依赖包,使用yum安装cmake,6.9默认yum源自带 yum -y install gcc-c++ cmake bison-devel ncurses-devel 2.创建mysql的用户: useradd  -U -s /sbin/nologin mysql 3.创建必要的文件夹,并修改其目录用户所有者: mkdir -pv /usr/local/mysql/etc mkdir -pv /da

centos6.5编译安装mysql5.6.14

1 查看机器上是否装有mysql rpm -qa | grep mysql 2. 删除已经存在的mysql rpm -e --nodeps mysql ()强力删除模式) 3.安装编译代码需要的包 yum -y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake openssl openssl-de

CentOS6.5编译安装MySQL5.5

安装依赖包: yum -y install gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool* 安装cmake: [[email protected] usr]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz [[email protected] usr]# tar xzvf cmake-2.8.12.tar.gz 

centos6.5 编译安装Mysql5.7.17

一.安装环境准备 centos 6.5 二.下载mysql source_code  这里说一下,进入myql下载页面后选择source_code:  然后选择 Generic Linux (Architecture Independent), Compressed TAR Archive   Includes Boost Headers 这个包下载.  也可以用下面的地址:  wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boo

centos6.7 编译安装mysql-5.6.27

安装依赖包: yum -y install make  gcc-c++ bison ncurses ncurses-devel 软件版本 cmake-2.8.8.tar.gz mysql-5.6.27.tar.gz 1.安装相关的包 1.2 cmake软件安装 cd /opt/tools tar xf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure make && make install cd .. 如果安装源不稳定可以换 163或者 阿里云的

centos6.9编译安装mysql-5.6.36

一 安装相关软件包[[email protected] ~]# yum -y install ncureses-devel libaio-devel[[email protected] tools]# yum install cmake –y 创建mysql运行用户[[email protected] tools]# useradd -s /sbin/nologin -M mysql 下载软件包[[email protected] tools]# wget https://downloads.m

CentOS6.3_64编译安装MySQL-5.5.37数据库

1.下载cmake: http://wwwNaNake.org/files/v2.8/cmake-2.8.10.2.tar.gz ./configure make && make install 2.vi /etc/profile: export PATH=/usr/local/cmake-2.8.10.2/bin:$PATH source /etc/profile 3.wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.