centos 7.0 编译 安装mysql 5.6.22 过程 已完成
时间:2016-06-08 14:00 来源:linux.it.net.cn 作者:IT
mysql 下载目录/usr/local/src
mysql 解压目录 /usr/local/bin/mysql
GitHub https://github.com/mysql/mysql-server
mysql官网的安装说明
http://dev.mysql.com/doc/refman/5.6/en/source-installation.html
安装mysql必须的要求
CMake make3.75以上 GCC 4.2.1以上 Perl
Curses ncurses-devel
最新3.1.1 cmake 安装
http://www.cmake.org/
下载页面
http://www.cmake.org/download/
下载目录/usr/local/src
wget http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz
[root@localhost src]# wget http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz
--2015-01-28 10:40:27-- http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz
正在解析主机 www.cmake.org (www.cmake.org)... 66.194.253.19
正在连接 www.cmake.org (www.cmake.org)|66.194.253.19|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:5959421 (5.7M) [application/x-gzip]
正在保存至: “cmake-3.1.1.tar.gz”
100%[======================================>] 5,959,421 494KB/s 用时 11s
2015-01-28 10:40:39 (524 KB/s) - 已保存 “cmake-3.1.1.tar.gz” [5959421/5959421])
解压目录 /usr/local/bin/cmake-3.1.1
[root@localhost src]tar zxvf cmake-3.1.1.tar.gz -C /usr/local/bin
进入解压目录
[root@localhost src]# cd /usr/local/bin/cmake-3.1.1
[root@localhost cmake-3.1.1]# ls
Auxiliary CompileFlags.cmake Help
bootstrap configure Licenses
CMakeCPack.cmake CONTRIBUTING.rst Modules
CMakeCPackOptions.cmake.in Copyright.txt README.rst
CMakeGraphVizOptions.cmake CTestConfig.cmake Source
CMakeLists.txt CTestCustom.cmake.in Templates
CMakeLogo.gif DartConfig.cmake Tests
cmake_uninstall.cmake.in doxygen.config Utilities
[root@localhost cmake-3.1.1]./bootstrap
[root@localhost cmake-3.1.1]make
[root@localhost cmake-3.1.1]make install
Make 4.1安装
http://www.gnu.org/software/make/
下载
wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
[root@localhost src]# wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
--2015-01-28 11:22:09-- http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
正在解析主机 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
正在连接 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1878787 (1.8M) [application/x-gzip]
正在保存至: “make-4.1.tar.gz”
100%[======================================>] 1,878,787 33.1KB/s 用时 65s
2015-01-28 11:23:16 (28.0 KB/s) - 已保存 “make-4.1.tar.gz” [1878787/1878787])
解压
[root@localhost src]tar zxvf make-4.1.tar.gz -C /usr/local/bin
[root@localhost src]# cd /usr/local/bin/make-4.1
[root@localhost make-4.1]# ls
ABOUT-NLS dep.h load.c README.VMS
acinclude.m4 dir.c main.c README.W32
aclocal.m4 doc make.1 remake.c
alloca.c dosbuild.bat Makefile.am remote-cstms.c
amiga.c expand.c Makefile.ami remote-stub.c
amiga.h file.c makefile.com rule.c
ar.c filedef.h Makefile.DOS rule.h
arscan.c function.c Makefile.in SCOPTIONS
AUTHORS getloadavg.c makefile.vms signame.c
build.sh.in getopt1.c makeint.h SMakefile
build_w32.bat getopt.c make.lnk strcache.c
commands.c getopt.h make_msvc_net2003.sln subproc.bat
commands.h gettext.h make_msvc_net2003.vcproj tests
config glob misc.c variable.c
config.ami gmk-default.h NEWS variable.h
configh.dos gmk-default.scm NMakefile version.c
config.h.in gnumake.h output.c vmsdir.h
config.h-vms guile.c output.h vmsfunctions.c
config.h.W32 hash.c po vmsify.c
configure hash.h read.c vmsjobs.c
configure.ac implicit.c README vpath.c
configure.bat INSTALL README.Amiga w32
COPYING job.c README.customs
debug.h job.h README.DOS
default.c loadapi.c README.OS2
[root@localhost make-4.1]./configure
[root@localhost make-4.1]make
[root@localhost make-4.1]make install
安装 M4
http://www.gnu.org/software/m4/
下载
wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
[root@localhost src]# wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
--2015-01-28 11:37:14-- http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
正在解析主机 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
正在连接 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1820658 (1.7M) [application/x-gzip]
正在保存至: “m4-latest.tar.gz”
100%[======================================>] 1,820,658 40.8KB/s 用时 42s
2015-01-28 11:37:57 (42.6 KB/s) - 已保存 “m4-latest.tar.gz” [1820658/1820658])
解压
[root@localhost src]# tar zxvf m4-latest.tar.gz -C /usr/local/bin
cd /usr/local/bin/m4-1.4.17
[root@localhost ~]# cd /usr/local/bin/m4-1.4.17
[root@localhost m4-1.4.17]# ls
acinclude.m4 build-aux configure GNUmakefile Makefile.am tests
aclocal.m4 c-boxes.el configure.ac INSTALL Makefile.in THANKS
AUTHORS cfg.mk COPYING lib NEWS TODO
BACKLOG ChangeLog doc m4 README
bootstrap checks examples maint.mk src
[root@localhost ~]./configure
[root@localhost ~]make
[root@localhost ~]make install
Bison 3.0.4
http://www.gnu.org/software/bison/
http://ftp.gnu.org/gnu/bison/
下载
wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz
[root@localhost src]# wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz
--2015-01-28 11:03:56-- http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz
正在解析主机 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
正在连接 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:3354179 (3.2M) [application/x-gzip]
正在保存至: “bison-3.0.4.tar.gz”
100%[======================================>] 3,354,179 41.0KB/s 用时 71s
2015-01-28 11:05:08 (45.8 KB/s) - 已保存 “bison-3.0.4.tar.gz” [3354179/3354179])
解压
tar zxvf bison-3.0.4.tar.gz -C /usr/local/bin
[root@localhost src]# tar zxvf bison-3.0.4.tar.gz -C /usr/local/bin
[root@localhost src]# cd /usr/local/bin/bison-3.0.4
[root@localhost bison-3.0.4]# ls
ABOUT-NLS ChangeLog-1998 djgpp lib PACKAGING src
aclocal.m4 ChangeLog-2012 doc m4 po tests
AUTHORS configure etc maint.mk README THANKS
build-aux configure.ac examples Makefile.am README-alpha TODO
cfg.mk COPYING GNUmakefile Makefile.in README-release
ChangeLog data INSTALL NEWS runtime-po
这里必须安装M4 在运行
[root@localhost bison-3.0.4]./configure
[root@localhost bison-3.0.4]make
[root@localhost bison-3.0.4]make install
ncurses-devel (RPM安装)
找到两个网址下载 随便来一个吧
http://pkgs.org/download/ncurses-devel
http://rpmfind.net/linux/rpm2html/search.php?query=ncurses-devel
下载
wget ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9-13.20130511.el7.x86_64.rpm
[root@localhost src]# wget ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9-
13.20130511.el7.x86_64.rpm
--2015-01-28 14:28:29-- ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9-
13.20130511.el7.x86_64.rpm
=> “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm”
正在解析主机 rpmfind.net (rpmfind.net)... 195.220.108.108
正在连接 rpmfind.net (rpmfind.net)|195.220.108.108|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /linux/centos/7.0.1406/os/x86_64/Packages ... 完成。
==> SIZE ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 729820
==> PASV ... 完成。 ==> RETR ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 完成。
长度:729820 (713K) (非正式数据)
100%[======================================>] 729,820 275KB/s 用时 2.6s
2015-01-28 14:28:36 (275 KB/s) - “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm” 已保存 [729820]
安装或者升级一个rpm包
rpm -ivh rpm文件【安装】
rpm -Uvh rpm文件【更新】
[root@localhost src]# rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:ncurses-devel-5.9-13.20130511.el7################################# [100%]
安装 mysql 5.66.22
遇到了不少问题 感觉最好的办法就是重新装一遍 记得cmake以前删除CMakeCache.txt
[root@localhost src]wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
解压
[root@localhost src]tar zxvf mysql-5.6.22.tar.gz -C /usr/local/bin
进入目录
这个图是后来从新编译的 就看下编译选项就好了
执行的命令
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/etc/mysql
-DMYSQL_DATADIR=/usr/etc/mysql/data
-DSYSCONFDIR=/etc/mysql/
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_HEAP_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
-DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
再次编译 改了下配置文件的位置 红色字体
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/etc/mysql \
-DMYSQL_DATADIR=/usr/etc/mysql/data \
-DSYSCONFDIR=/usr/etc/mysql \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_HEAP_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/usr/etc/mysql/mysqld.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[root@localhost mysql-5.6.22]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/etc/mysql \
-DMYSQL_DATADIR=/usr/etc/mysql/data \
-DSYSCONFDIR=/usr/etc/mysql \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_HEAP_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/usr/etc/mysql/mysqld.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[root@localhost mysql-5.6.22]make
[root@localhost mysql-5.6.22]make install
进入安装目录
初始化数据库
资料引用
初始化安装 官网介绍 mysql_install_db
http://dev.mysql.com/doc/refman/5.6/en/unix-postinstallation.html
http://dev.mysql.com/doc/refman/5.6/en/postinstallation.html
http://www.cnblogs.com/xiongpq/p/3384681.html
./mysql_install_db --user=mysql --basedir=/usr/etc/mysql --datadir=/usr/etc/mysql/data
最主要要定义
--basedir 安装目录
--datadir 数据存放目录
[root@localhost scripts]# ./mysql_install_db --user=mysql --basedir=/usr/etc/mysql --datadir=/usr/etc/mysql/data
Installing MySQL system tables...2015-02-10 13:22:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-10 13:22:26 3334 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-02-10 13:22:26 3334 [Note] InnoDB: The InnoDB memory heap is disabled
2015-02-10 13:22:26 3334 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-02-10 13:22:26 3334 [Note] InnoDB: Memory barrier is not used
2015-02-10 13:22:26 3334 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-02-10 13:22:26 3334 [Note] InnoDB: Not using CPU crc32 instructions
2015-02-10 13:22:26 3334 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-02-10 13:22:26 3334 [Note] InnoDB: Completed initialization of buffer pool
2015-02-10 13:22:26 3334 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be
created!
2015-02-10 13:22:26 3334 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-02-10 13:22:26 3334 [Note] InnoDB: Database physically writes the file full: wait...
2015-02-10 13:22:26 3334 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-02-10 13:22:27 3334 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-02-10 13:22:28 3334 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-02-10 13:22:28 3334 [Warning] InnoDB: New log files created, LSN=45781
2015-02-10 13:22:28 3334 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-02-10 13:22:28 3334 [Note] InnoDB: Doublewrite buffer created
2015-02-10 13:22:28 3334 [Note] InnoDB: 128 rollback segment(s) are active.
2015-02-10 13:22:28 3334 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-02-10 13:22:28 3334 [Note] InnoDB: Foreign key constraint system tables created
2015-02-10 13:22:28 3334 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-02-10 13:22:28 3334 [Note] InnoDB: Tablespace and datafile system tables created.
2015-02-10 13:22:28 3334 [Note] InnoDB: Waiting for purge to start
2015-02-10 13:22:28 3334 [Note] InnoDB: 5.6.22 started; log sequence number 0
2015-02-10 13:22:30 3334 [Note] Binlog end
2015-02-10 13:22:30 3334 [Note] InnoDB: FTS optimize thread exiting.
2015-02-10 13:22:30 3334 [Note] InnoDB: Starting shutdown...
2015-02-10 13:22:32 3334 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2015-02-10 13:22:32 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-10 13:22:32 3358 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-02-10 13:22:32 3358 [Note] InnoDB: The InnoDB memory heap is disabled
2015-02-10 13:22:32 3358 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-02-10 13:22:32 3358 [Note] InnoDB: Memory barrier is not used
2015-02-10 13:22:32 3358 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-02-10 13:22:32 3358 [Note] InnoDB: Not using CPU crc32 instructions
2015-02-10 13:22:32 3358 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-02-10 13:22:32 3358 [Note] InnoDB: Completed initialization of buffer pool
2015-02-10 13:22:32 3358 [Note] InnoDB: Highest supported file format is Barracuda.
2015-02-10 13:22:32 3358 [Note] InnoDB: 128 rollback segment(s) are active.
2015-02-10 13:22:32 3358 [Note] InnoDB: Waiting for purge to start
2015-02-10 13:22:32 3358 [Note] InnoDB: 5.6.22 started; log sequence number 1625977
2015-02-10 13:22:32 3358 [Note] Binlog end
2015-02-10 13:22:32 3358 [Note] InnoDB: FTS optimize thread exiting.
2015-02-10 13:22:32 3358 [Note] InnoDB: Starting shutdown...
2015-02-10 13:22:33 3358 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/etc/mysql/bin/mysqladmin -u root password 'new-password'
/usr/etc/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/etc/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/etc/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/etc/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[root@localhost scripts]#
上面的警告 应该都能读懂 如果在/etc下有my.cnf文件 就是优先加载这个配置 所以就删除吧
rm -f my.cnf
删除默认/etc/my.cnf
cd /etc/
rm -f my.cnf
编辑安装目录下的配置文件/usr/etc/mysql/my.cnf
# These are commonly set, remove the # and set as required.
basedir = /usr/etc/mysql
datadir = /usr/etc/mysql/data
port = 3306
# server_id = .....
# socket = .....
参考 http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
添加用户mysql
[root@localhost data]# useradd mysql
[root@localhost data]# groupadd mysql
groupadd:“mysql”组已存在
给安装目录权限
先给权限 要不然mysql 无法正常启动
[root@localhost data]# chown -R mysql:mysql /usr/etc/mysql
复制mysql.server到启动目录init.d
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@localhost mysql]# chkconfig mysql on
启动mysql
[root@localhost data]# service mysql start
Starting MySQL. SUCCESS!
启动成功
[root@localhost data]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 23841 mysql 10u IPv6 756200 0t0 TCP *:mysql (LISTEN)
登录成功
退出mysql 直接ctrl + z
***************************************************************************************
有错误 看看错误日志里记录啥了
查看错误日志
vi /usr/etc/mysql/data/localhost.localdomain.err
150130 11:29:18 mysqld_safe Starting mysqld daemon with databases from /usr/etc/mysql/data
2015-01-30 11:29:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-30 11:29:19 22264 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
2015-01-30 11:29:19 22264 [ERROR] Aborting
2015-01-30 11:29:19 22264 [Note] Binlog end
2015-01-30 11:29:19 22264 [Note] /usr/etc/mysql/bin/mysqld: Shutdown complete
150130 11:29:19 mysqld_safe mysqld from pid file /usr/etc/mysql/data/localhost.localdomain.pid ended
150130 11:36:24 mysqld_safe Starting mysqld daemon with databases from /usr/etc/mysql/data
2015-01-30 11:36:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-30 11:36:25 22903 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
2015-01-30 11:36:25 22903 [ERROR] Aborting
2015-01-30 11:36:25 22903 [Note] Binlog end
2015-01-30 11:36:25 22903 [Note] /usr/etc/mysql/bin/mysqld: Shutdown complete
150130 11:36:25 mysqld_safe mysqld from pid file /usr/etc/mysql/data/localhost.localdomain.pid ended
*************************************************************************************
可能出现的问题:
我出现下面这个问题就是没有mysql这个用户 还没有给安装目录权限的问题
[root@localhost mysql]# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/usr/etc/mysql/localhost.localdomain.pid).
具体如下解决的
[root@localhost data]# useradd mysql
[root@localhost data]# chown -R mysql:mysql /usr/etc/mysql
参考
http://blog.rekfan.com/articles/186.html
*************************************************************************************
以下是参考记录而已~
查看user表里的记录 /usr/etc/mysql/bin
[root@localhost bin]# mysql -e "SELECT * FROM user" mysql
mysql -e "SELECT Host,User,Password FROM user" mysql
最后我还安装了
下载perl
wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz
[root@localhost src]# wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz
解压
tar zxvf perl-5.20.1.tar.gz -C /usr/local/bin
进入解压目录
[root@localhost src]# cd /usr/local/bin/perl-5.20.1
[root@localhost perl-5.20.1]./Configure -des -Dprefix=/usr/etc/perl
[root@localhost perl-5.20.1]make
[root@localhost perl-5.20.1]make install
查看是否安装好模块
[root@localhost mysql]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-
bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-
checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --
enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --
enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-
redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --
enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
[root@localhost mysql]# perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@localhost scripts]# yum install -y perl-Module-Install.noarch
*****************************************************************
给自己补充用的知识点
MySQL安全配置向导mysql_secure_installation
运行mysql_secure_installation会执行几个设置:
a)为root用户设置密码
b)删除匿名账号
c)取消root用户远程登录
d)删除test库和对test库的访问权限
e)刷新授权表使修改生效
进入安装目录cd /usr/etc/mysql/bin
执行 mysql_secure_installation 回车 一般都是直接Y
(责任编辑:IT)
mysql 下载目录/usr/local/src GitHub https://github.com/mysql/mysql-server
mysql官网的安装说明
安装mysql必须的要求
下载页面
下载目录/usr/local/src [root@localhost src]# wget http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz --2015-01-28 10:40:27-- http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz 正在解析主机 www.cmake.org (www.cmake.org)... 66.194.253.19 正在连接 www.cmake.org (www.cmake.org)|66.194.253.19|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:5959421 (5.7M) [application/x-gzip] 正在保存至: “cmake-3.1.1.tar.gz” 100%[======================================>] 5,959,421 494KB/s 用时 11s 2015-01-28 10:40:39 (524 KB/s) - 已保存 “cmake-3.1.1.tar.gz” [5959421/5959421])
[root@localhost src]tar zxvf cmake-3.1.1.tar.gz -C /usr/local/bin
进入解压目录
[root@localhost cmake-3.1.1]./bootstrap
[root@localhost src]# wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz --2015-01-28 11:22:09-- http://ftp.gnu.org/gnu/make/make-4.1.tar.gz 正在解析主机 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b 正在连接 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:1878787 (1.8M) [application/x-gzip] 正在保存至: “make-4.1.tar.gz” 100%[======================================>] 1,878,787 33.1KB/s 用时 65s 2015-01-28 11:23:16 (28.0 KB/s) - 已保存 “make-4.1.tar.gz” [1878787/1878787])
解压 [root@localhost src]tar zxvf make-4.1.tar.gz -C /usr/local/bin [root@localhost src]# cd /usr/local/bin/make-4.1 [root@localhost make-4.1]# ls ABOUT-NLS dep.h load.c README.VMS acinclude.m4 dir.c main.c README.W32 aclocal.m4 doc make.1 remake.c alloca.c dosbuild.bat Makefile.am remote-cstms.c amiga.c expand.c Makefile.ami remote-stub.c amiga.h file.c makefile.com rule.c ar.c filedef.h Makefile.DOS rule.h arscan.c function.c Makefile.in SCOPTIONS AUTHORS getloadavg.c makefile.vms signame.c build.sh.in getopt1.c makeint.h SMakefile build_w32.bat getopt.c make.lnk strcache.c commands.c getopt.h make_msvc_net2003.sln subproc.bat commands.h gettext.h make_msvc_net2003.vcproj tests config glob misc.c variable.c config.ami gmk-default.h NEWS variable.h configh.dos gmk-default.scm NMakefile version.c config.h.in gnumake.h output.c vmsdir.h config.h-vms guile.c output.h vmsfunctions.c config.h.W32 hash.c po vmsify.c configure hash.h read.c vmsjobs.c configure.ac implicit.c README vpath.c configure.bat INSTALL README.Amiga w32 COPYING job.c README.customs debug.h job.h README.DOS default.c loadapi.c README.OS2
[root@localhost make-4.1]./configure
下载
[root@localhost src]# wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz 100%[======================================>] 1,820,658 40.8KB/s 用时 42s 2015-01-28 11:37:57 (42.6 KB/s) - 已保存 “m4-latest.tar.gz” [1820658/1820658])
解压 cd /usr/local/bin/m4-1.4.17
[root@localhost ~]# cd /usr/local/bin/m4-1.4.17
[root@localhost ~]./configure
http://ftp.gnu.org/gnu/bison/
下载 [root@localhost src]# wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz --2015-01-28 11:03:56-- http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz 正在解析主机 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b 正在连接 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:3354179 (3.2M) [application/x-gzip] 正在保存至: “bison-3.0.4.tar.gz” 100%[======================================>] 3,354,179 41.0KB/s 用时 71s 2015-01-28 11:05:08 (45.8 KB/s) - 已保存 “bison-3.0.4.tar.gz” [3354179/3354179])
解压 [root@localhost src]# tar zxvf bison-3.0.4.tar.gz -C /usr/local/bin
这里必须安装M4 在运行
[root@localhost bison-3.0.4]make
下载 [root@localhost src]# wget ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9- 13.20130511.el7.x86_64.rpm --2015-01-28 14:28:29-- ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9- 13.20130511.el7.x86_64.rpm => “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm” 正在解析主机 rpmfind.net (rpmfind.net)... 195.220.108.108 正在连接 rpmfind.net (rpmfind.net)|195.220.108.108|:21... 已连接。 正在以 anonymous 登录 ... 登录成功! ==> SYST ... 完成。 ==> PWD ... 完成。 ==> TYPE I ... 完成。 ==> CWD (1) /linux/centos/7.0.1406/os/x86_64/Packages ... 完成。 ==> SIZE ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 729820 ==> PASV ... 完成。 ==> RETR ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 完成。 长度:729820 (713K) (非正式数据) 100%[======================================>] 729,820 275KB/s 用时 2.6s 2015-01-28 14:28:36 (275 KB/s) - “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm” 已保存 [729820]
[root@localhost src]# rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm 准备中... ################################# [100%] 正在升级/安装... 1:ncurses-devel-5.9-13.20130511.el7################################# [100%]
这个图是后来从新编译的 就看下编译选项就好了
执行的命令 cmake \ -DCMAKE_INSTALL_PREFIX=/usr/etc/mysql -DMYSQL_DATADIR=/usr/etc/mysql/data -DSYSCONFDIR=/etc/mysql/ -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_HEAP_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci 再次编译 改了下配置文件的位置 红色字体
cmake \
[root@localhost mysql-5.6.22]# cmake \ [root@localhost mysql-5.6.22]make install
进入安装目录
初始化数据库
./mysql_install_db --user=mysql --basedir=/usr/etc/mysql --datadir=/usr/etc/mysql/data 最主要要定义 --basedir 安装目录 --datadir 数据存放目录
[root@localhost scripts]# ./mysql_install_db --user=mysql --basedir=/usr/etc/mysql --datadir=/usr/etc/mysql/data
Filling help tables...2015-02-10 13:22:32 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
To start mysqld at boot time you have to copy
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
/usr/etc/mysql/bin/mysqladmin -u root password 'new-password' Alternatively you can run: /usr/etc/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test See the manual for more instructions. You can start the MySQL daemon with: cd . ; /usr/etc/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/etc/mysql/my.cnf and [root@localhost scripts]# 上面的警告 应该都能读懂 如果在/etc下有my.cnf文件 就是优先加载这个配置 所以就删除吧 rm -f my.cnf
删除默认/etc/my.cnf 编辑安装目录下的配置文件/usr/etc/mysql/my.cnf
# These are commonly set, remove the # and set as required. 参考 http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
添加用户mysql [root@localhost data]# useradd mysql
[root@localhost data]# groupadd mysql
给安装目录权限 先给权限 要不然mysql 无法正常启动 [root@localhost data]# chown -R mysql:mysql /usr/etc/mysql
复制mysql.server到启动目录init.d
[root@localhost data]# service mysql start
启动成功
[root@localhost data]# lsof -i:3306 登录成功
退出mysql 直接ctrl + z
*************************************************************************************** 有错误 看看错误日志里记录啥了 查看错误日志 vi /usr/etc/mysql/data/localhost.localdomain.err
150130 11:29:18 mysqld_safe Starting mysqld daemon with databases from /usr/etc/mysql/data 2015-01-30 11:29:19 22264 [ERROR] Aborting
2015-01-30 11:29:19 22264 [Note] Binlog end
150130 11:29:19 mysqld_safe mysqld from pid file /usr/etc/mysql/data/localhost.localdomain.pid ended
2015-01-30 11:36:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
2015-01-30 11:36:25 22903 [Note] Binlog end 150130 11:36:25 mysqld_safe mysqld from pid file /usr/etc/mysql/data/localhost.localdomain.pid ended ************************************************************************************* 可能出现的问题:
我出现下面这个问题就是没有mysql这个用户 还没有给安装目录权限的问题
[root@localhost mysql]# service mysql start 具体如下解决的 [root@localhost data]# useradd mysql [root@localhost data]# chown -R mysql:mysql /usr/etc/mysql
参考 *************************************************************************************
以下是参考记录而已~ 查看user表里的记录 /usr/etc/mysql/bin [root@localhost bin]# mysql -e "SELECT * FROM user" mysql mysql -e "SELECT Host,User,Password FROM user" mysql
最后我还安装了
下载perl
[root@localhost src]# wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz tar zxvf perl-5.20.1.tar.gz -C /usr/local/bin 进入解压目录 [root@localhost src]# cd /usr/local/bin/perl-5.20.1 [root@localhost perl-5.20.1]./Configure -des -Dprefix=/usr/etc/perl [root@localhost perl-5.20.1]make [root@localhost perl-5.20.1]make install
查看是否安装好模块
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
Complete documentation for Perl, including FAQ lists, should be found on
[root@localhost scripts]# yum install -y perl-Module-Install.noarch ***************************************************************** 给自己补充用的知识点 MySQL安全配置向导mysql_secure_installation
运行mysql_secure_installation会执行几个设置: 进入安装目录cd /usr/etc/mysql/bin 执行 mysql_secure_installation 回车 一般都是直接Y (责任编辑:IT) |