Red Hat5下源码安装mysql5.6过程记录

时间:2022-05-06 16:35:02

1.安装cmake包

[root@edu soft]# tar -xzf cmake-3.0..tar.Z
[root@edu soft]# cd cmake-3.0.
[root@edu cmake-3.0.]# ./configure #对包进行初始化配置
......
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for wsyncup in /usr/lib/libcurses.so
-- Looking for wsyncup in /usr/lib/libcurses.so - found
-- Looking for cbreak in /usr/lib/libncurses.so
-- Looking for cbreak in /usr/lib/libncurses.so - found
-- Looking for elf.h
-- Looking for elf.h - found
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - /usr/bin/f95
-- Performing Test run_pic_test
-- Performing Test run_pic_test - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /root/soft/cmake-3.0.
---------------------------------------------
CMake has bootstrapped. Now run gmake.
[root@edu cmake-3.0.]# gmake   #配置完成后进行编译
...... [ %] Building CXX object Tests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o
Linking CXX executable runcompilecommands
[ %] Built target runcompilecommands
Scanning dependencies of target foo
[ %] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o
Linking CXX static library libfoo.a
[ %] Built target foo
Scanning dependencies of target memcheck_fail
[ %] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/memcheck_fail.dir/ret1.cxx.o
Linking CXX executable memcheck_fail
[ %] Built target memcheck_fail
Scanning dependencies of target pseudo_BC
[ %] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_BC.dir/ret0.cxx.o
Linking CXX executable BC
[ %] Built target pseudo_BC
Scanning dependencies of target pseudo_purify
[ %] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_purify.dir/ret0.cxx.o
Linking CXX executable purify
[ %] Built target pseudo_purify
Scanning dependencies of target pseudo_valgrind
[%] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_valgrind.dir/ret0.cxx.o
Linking CXX executable valgrind
[%] Built target pseudo_valgrind
Scanning dependencies of target pseudonl_BC
[%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_BC.dir/ret0.c.o
Linking C executable BC
[%] Built target pseudonl_BC
Scanning dependencies of target pseudonl_purify
[%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_purify.dir/ret0.c.o
Linking C executable purify
[%] Built target pseudonl_purify
Scanning dependencies of target pseudonl_valgrind
[%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_valgrind.dir/ret0.c.o
Linking C executable valgrind
[%] Built target pseudonl_valgrind
[root@edu cmake-3.0.]# make install  #编译完成后进行安装
......
-- Installing: /usr/local/share/cmake-3.0/Templates/CPack.GenericLicense.txt
-- Installing: /usr/local/share/cmake-3.0/Templates/DLLHeader.dsptemplate
-- Installing: /usr/local/share/cmake-3.0/Templates/EXEWinHeader.dsptemplate
-- Installing: /usr/local/share/cmake-3.0/Templates/CPack.GenericWelcome.txt
-- Installing: /usr/local/share/cmake-3.0/Templates/CTestScript.cmake.in
-- Installing: /usr/local/share/cmake-3.0/Templates/TestDriver.cxx.in
-- Installing: /usr/local/share/cmake-3.0/Templates/CMakeVSMacros1.vsmacros
-- Installing: /usr/local/share/cmake-3.0/Templates/CMakeVSMacros2.vsmacros
-- Installing: /usr/local/share/cmake-3.0/Templates/EXEFooter.dsptemplate
-- Installing: /usr/local/share/cmake-3.0/Templates/cygwin-package.sh.in
-- Installing: /usr/local/share/cmake-3.0/Templates/CPackConfig.cmake.in
-- Installing: /usr/local/share/cmake-3.0/Templates/staticLibFooter.dsptemplate
-- Installing: /usr/local/share/cmake-3.0/Templates/CMakeVisualStudio6Configurations.cmake
-- Installing: /usr/local/share/cmake-3.0/Templates/CPack.GenericDescription.txt
-- Installing: /usr/local/share/cmake-3.0/Templates/EXEHeader.dsptemplate
-- Installing: /usr/local/share/cmake-3.0/Templates/staticLibHeader.dsptemplate
-- Installing: /usr/local/doc/cmake-3.0/cmsys/Copyright.txt
-- Installing: /usr/local/doc/cmake-3.0/cmzlib/Copyright.txt
-- Installing: /usr/local/doc/cmake-3.0/cmcurl/COPYING
-- Installing: /usr/local/doc/cmake-3.0/cmcompress/Copyright.txt
-- Installing: /usr/local/doc/cmake-3.0/cmlibarchive/COPYING
-- Installing: /usr/local/doc/cmake-3.0/cmexpat/COPYING
-- Installing: /usr/local/bin/ccmake
-- Installing: /usr/local/bin/cmake
-- Installing: /usr/local/bin/ctest
-- Installing: /usr/local/bin/cpack
-- Installing: /usr/local/share/cmake-3.0/include/cmCPluginAPI.h
-- Installing: /usr/local/share/cmake-3.0/editors/vim/cmake-help.vim
-- Installing: /usr/local/share/cmake-3.0/editors/vim/cmake-indent.vim
-- Installing: /usr/local/share/cmake-3.0/editors/vim/cmake-syntax.vim
-- Installing: /usr/local/share/cmake-3.0/editors/emacs/cmake-mode.el
-- Installing: /usr/local/share/aclocal/cmake.m4
-- Installing: /usr/local/share/cmake-3.0/completions/cmake
-- Installing: /usr/local/share/cmake-3.0/completions/cpack
-- Installing: /usr/local/share/cmake-3.0/completions/ctest

2.创建mysql用户信息

[root@edu ~]# useradd -M -u  -s /sbin/nologin mysql
[root@edu ~]# mkdir -p /var/mysql/data
[root@edu ~]# mkdir -p /var/mysql/log
[root@edu ~]# chown -R mysql.mysql /var/mysql
[root@edu ~]# ll /var/mysql
total
drwxr-xr-x mysql mysql Feb : data
drwxr-xr-x mysql mysql Feb : log

3.编译安装mysql

[root@edu local]# mkdir mysql
[root@edu local]# cd mysql/
[root@edu mysql]# pwd
/usr/local/mysql
[root@edu data]# mkdir /var/lib/mysql
[root@edu data]# cd /var/lib/mysql/
[root@edu mysql]# pwd
/var/lib/mysql
[root@edu mysql]# cd /root/mysql-5.6.
[root@edu mysql-5.6.]# cmake -DCMAKE_BUILD_TYPE:STRING=Release \
> -DMYSQL_USER=mysql \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_DATADIR=/var/mysql/data \
> -DSYSCONFDIR=/etc \
> -DWITH_MYISAM_STORAGE_ENGINE= \
> -DWITH_INNOBASE_STORAGE_ENGINE= \
> -DWITH_MEMORY_STORAGE_ENGINE= \
> -DWITH_ARCHIVE_STORAGE_ENGINE= \
> -DWITH_BLACKHOLE_STORAGE_ENGINE= \
> -DWITHOUT_FEDERATED_STORAGE_ENGINE= \
> -DWITH_READLINE= \
> -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
> -DMYSQL_TCP_PORT= \
> -DENABLED_LOCAL_INFILE= \
> -DEXTRA_CHARSETS=all \
> -DDEFAULT_CHARSET=utf8 \
> -DWITH_SSL=yes \
> -DDEFAULT_COLLATION=utf8_general_ci
......
[root@edu cmake-3.0.]# make
.......
[ %] Generating mysqlserver_depends.c
Scanning dependencies of target mysqlserver
[ %] Building C object libmysqld/CMakeFiles/mysqlserver.dir/mysqlserver_depends.c.o
Linking C static library libmysqld.a
/usr/bin/ar: creating /root/mysql-5.6./libmysqld//libmysqld.a
[ %] Built target mysqlserver
Scanning dependencies of target mysql_client_test_embedded
[ %] Building C object libmysqld/examples/CMakeFiles/mysql_client_test_embedded.dir/__/__/tests/mysql_client_test.c.o
Linking CXX executable mysql_client_test_embedded
[ %] Built target mysql_client_test_embedded
Scanning dependencies of target mysql_embedded
[ %] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o
[ %] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o
/root/mysql-5.6./client/mysql.cc:: warning: dereferencing type-punned pointer will break strict-aliasing rules
/root/mysql-5.6./client/mysql.cc:: warning: dereferencing type-punned pointer will break strict-aliasing rules
[%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o
Linking CXX executable mysql_embedded
[%] Built target mysql_embedded
Scanning dependencies of target mysqltest_embedded
[%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
/root/mysql-5.6./client/mysqltest.cc: In function 鈥榗har* re_eprint(int)鈥?
/root/mysql-5.6./client/mysqltest.cc:: warning: unused variable 鈥榣en鈥?
Linking CXX executable mysqltest_embedded
[%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[%] Built target my_safe_process

编译的可能会报错,要注意内存的大小,去掉-DWITHOUT_PARTITION_STORAGE_ENGINE=1参数
-DWITHOUT_PARTITION_STORAGE_ENGINE=1参数在本次make的时候大约80%的时候会报错

注意:如果重新编译或者编译出错了,需要清除旧的对象文件和缓存信息。

# make clean

# rm -f CMakeCache.txt

# rm -rf /etc/my.cnf

然后再:make , make install即可。

[root@edu cmake-3.0.]# make install
......
-- Installing: /usr/local/mysql/man/man1/myisam_ftdump.
-- Installing: /usr/local/mysql/man/man1/mysql_install_db.
-- Installing: /usr/local/mysql/man/man1/mysql_config.
-- Installing: /usr/local/mysql/man/man1/mysql_tzinfo_to_sql.
-- Installing: /usr/local/mysql/man/man1/mysqlbug.
-- Installing: /usr/local/mysql/man/man1/mysql_upgrade.
-- Installing: /usr/local/mysql/man/man1/mysqlshow.
-- Installing: /usr/local/mysql/man/man1/myisamchk.
-- Installing: /usr/local/mysql/man/man1/mysql_find_rows.
-- Installing: /usr/local/mysql/man/man1/mysqlcheck.
-- Installing: /usr/local/mysql/man/man1/mysqlimport.
-- Installing: /usr/local/mysql/man/man1/innochecksum.
-- Installing: /usr/local/mysql/man/man1/mysqld_safe.
-- Installing: /usr/local/mysql/man/man1/msql2mysql.
-- Installing: /usr/local/mysql/man/man1/mysql_client_test.
-- Installing: /usr/local/mysql/man/man1/mysql_plugin.
-- Installing: /usr/local/mysql/man/man1/mysql_client_test_embedded.
-- Installing: /usr/local/mysql/man/man1/mysql_secure_installation.
-- Installing: /usr/local/mysql/man/man1/mysql.server.
-- Installing: /usr/local/mysql/man/man1/mysql_fix_extensions.
-- Installing: /usr/local/mysql/man/man1/resolve_stack_dump.
-- Installing: /usr/local/mysql/man/man1/mysql-stress-test.pl.
-- Installing: /usr/local/mysql/man/man1/mysql.
-- Installing: /usr/local/mysql/man/man1/mysqladmin.
-- Installing: /usr/local/mysql/man/man1/mysql-test-run.pl.
-- Installing: /usr/local/mysql/man/man1/mysql_convert_table_format.
-- Installing: /usr/local/mysql/man/man1/my_print_defaults.
-- Installing: /usr/local/mysql/man/man1/mysqldump.
-- Installing: /usr/local/mysql/man/man1/mysql_setpermission.
-- Installing: /usr/local/mysql/man/man1/mysqlhotcopy.
-- Installing: /usr/local/mysql/man/man1/perror.
-- Installing: /usr/local/mysql/man/man8/mysqld.
[root@edu mysql]# ll /usr/local/mysql/
total
drwxr-xr-x root root Feb : bin
-rw-r--r-- root root May COPYING
drwxr-xr-x root root Feb : data
drwxr-xr-x root root Feb : docs
drwxr-xr-x root root Feb : include
-rw-r--r-- root root May INSTALL-BINARY
drwxr-xr-x root root Feb : lib
drwxr-xr-x root root Feb : man
drwxr-xr-x root root Feb : mysql-test
-rw-r--r-- root root May README
drwxr-xr-x root root Feb : scripts
drwxr-xr-x root root Feb : share
drwxr-xr-x root root Feb : sql-bench
drwxr-xr-x root root Feb : support-files

4.修改配置

[root@edu mysql-5.6.]# cp support-files/my-default.cnf /etc/my.cnf
[root@edu mysql-5.6.]# vi /etc/my.cnf # For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# 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 # These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = ..... # Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
datadir =/var/mysql/data
skip-name-resolve
lower_case_table_names = 1
character-set-server = utf8
query_cache_limit = 10M
max_heap_table_size = 64M
max_connections = 2000
log-error=/var/mysql/log/mysql_error.log
pid-file =/var/mysql/log/mysql.pid
general_log = 1
log_output= TABLE
log-bin =/var/mysql/log/mysql_bin
slow_query_log = ON
slow_query_log_file=/var/mysql/log/mysql_slow.log
long_query_time = 2
explicit_defaults_for_timestamp=true
"/etc/my.cnf" 46L, 1531C written
[root@edu mysql-5.6.]#

4.初始化数据库

[root@edu mysql-5.6.]# /usr/local/mysql/scripts/mysql_install_db \
> --user=mysql \
> --datadir=/var/mysql/data \
> --basedir=/usr/local/mysql \
> --log-output=file
Installing MySQL system tables...[root@edu mysql-5.6.]#

系统只提示Installing MySQL system tables...就结束了,感觉不正常,查看系统日志:

[root@edu log]# tail -f mysql_error.log

-- ::  [Note] InnoDB: Using mutexes to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using Linux native AIO
-- :: [Note] InnoDB: Not using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
-- :: [Note] InnoDB: Setting file ./ibdata1 size to MB
2016-02-01 16:39:16 14116 [Note] InnoDB: Database physically writes the file full: wait... --此处发现空间已满
-- :: b7f2b6d0 InnoDB: Error: Write to file ./ibdata1 failed at offset .
InnoDB: bytes should have been written, only - were written.
InnoDB: Operating system error number .
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number means 'No space left on device'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
-- :: [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space
-- :: [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
-- :: [ERROR] Plugin 'InnoDB' init function returned error.
-- :: [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
-- :: [ERROR] /usr/loc
[oracle@edu ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 % /
tmpfs % /dev/shm

发现磁盘空间不足,增加磁盘后将mysql的数据及日志文件挂载到新磁盘,以下为挂载过程(虚拟机):

[root@edu ~]# cd /var/mysql/
[root@edu mysql]# ls
data log
[root@edu mysql]# ll
total
drwxr-xr-x mysql mysql Feb : data
drwxr-xr-x mysql mysql Feb : log
[root@edu mysql]# ll -d /var/mysql
drwxr-xr-x mysql mysql Feb : /var/mysql
[root@edu mysql]# rm -rf *
[root@edu mysql]# vi /etc/fstab LABEL=/ / ext3 defaults
tmpfs /dev/shm tmpfs defaults
devpts /dev/pts devpts gid=,mode=
sysfs /sys sysfs defaults
proc /proc proc defaults
LABEL=SWAP-sda2 swap swap defaults
/dev/sdb1 /var/mysql ext3 defaults
~
"/etc/fstab" 7L, 532C written
[root@edu mysql]# mount -a
[root@edu mysql]# df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda1 % /
tmpfs % /dev/shm
/dev/sdb1 % /var/mysql
[root@edu mysql]# mkdir data
[root@edu mysql]# mkdir log
[root@edu mysql]# ll
total
drwxr-xr-x root root Feb : data
drwxr-xr-x root root Feb : log
[root@edu mysql]# chown mysql.mysql *
[root@edu mysql]# ll
total
drwxr-xr-x mysql mysql Feb : data
drwxr-xr-x mysql mysql Feb : log
[root@edu mysql]#

然后再清理下/dev/sda1下不用文件,清理下oracle下的归档文件及日志文件:

[oracle@edu archivelog_dest]$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda1 % /
tmpfs % /dev/shm
/dev/sdb1 % /var/mysql

重新执行mysql_install_db脚本:

[root@edu mysql-5.6.]# /usr/local/mysql/scripts/mysql_install_db \
> --user=mysql \
> --datadir=/var/mysql/data \
> --basedir=/usr/local/mysql \
> --log-output=file
Installing MySQL system tables...OK Filling help tables...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/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h edu password 'new-password' Alternatively you can run: /usr/local/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/local/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 WARNING: Found existing config file /usr/local/mysql/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/local/mysql/my-new.cnf,
please compare it with your file and take the changes you need. WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

5.启动mysql数据库

[root@edu mysql-5.6.]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@edu mysql-5.6.19]# ln -s /usr/local/mysql/lib/* /usr/lib/
[root@edu mysql-5.6.19]# ln -s /usr/local/mysql/include/* /usr/include/
[root@edu mysql-5.6.19]# ldconfig
[root@edu mysql-5.6.19]# cp /root/mysql-5.6.19/support-files/mysql.server /etc/init.d/mysqld
[root@edu mysql-5.6.19]# chmod 755 /etc/init.d/mysqld
[root@edu mysql-5.6.19]# /etc/init.d/mysqld status
MySQL is not running [FAILED]
[root@edu ~]# /etc/init.d/mysqld start
Starting MySQL....The server quit without updating PID file[FAILED]ysql/log/mysql.pid).

发现启动失败,查看错误日志:

[root@edu log]# tail -f mysql_error.log
-- :: [Note] InnoDB: Using mutexes to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using Linux native AIO
-- :: [Note] InnoDB: Not using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [Note] InnoDB: Highest supported file format is Barracuda.
-- :: [Note] InnoDB: rollback segment(s) are active.
-- :: [Note] InnoDB: Waiting for purge to start
-- :: [Note] InnoDB: 5.6. started; log sequence number
-- :: [Note] Server hostname (bind-address): '*'; port:
-- :: [Note] IPv6 is available.
-- :: [Note] - '::' resolves to '::';
-- :: [Note] Server socket created on IP: '::'.
-- :: [ERROR] Can't start server : Bind on unix socket: Permission denied --发现权限应该不对
-- :: [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?

修改权限重新启动:

[root@edu lib]# pwd
/var/lib
[root@edu lib]# ll -d mysql/
drwxr-xr-x root root Feb : mysql/
[root@edu lib]# chown -R mysql.mysql mysql
[root@edu lib]# ll -d mysql/
drwxr-xr-x mysql mysql Feb : mysql/
[root@edu ~]# /etc/init.d/mysqld start
Starting MySQL... [ OK ]

6.mysql访问测试

[root@edu ~]# mysqladmin -u root password ''
[root@edu ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-log Source distribution Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select version()
-> ;
+------------+
| version() |
+------------+
| 5.6.-log |
+------------+
row in set (0.00 sec) mysql> show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql_bin. | |
| mysql_bin. | |
| mysql_bin. | |
| mysql_bin. | |
| mysql_bin. | |
+------------------+-----------+
rows in set (0.00 sec) mysql> exit
Bye
[root@edu ~]# mysql -V
mysql Ver 14.14 Distrib 5.6., for Linux (i686) using EditLine wrapper
[root@edu ~]# mysql --version
mysql Ver 14.14 Distrib 5.6., for Linux (i686) using EditLine wrapper

参考:

cmake参数

http://blog.sina.com.cn/s/blog_68c25adf0101402v.html

http://blog.csdn.net/lyd518/article/details/20284379

make命令

http://www.jb51.net/LINUXjishu/65444.html

mysql配置文件my.cnf详解[部分]

http://www.cnblogs.com/toby/articles/2198697.html

------------------------------------cmake---------------------------
-DCMAKE_INSTALL_PREFIX= 指向mysql安装目录
-DINSTALL_SBINDIR=sbin 指向可执行文件目录(prefix/sbin)
-DMYSQL_DATADIR=/var/lib/mysql 指向mysql数据文件目录(/var/lib/mysql)
-DSYSCONFDIR=/etc/mysql 指向mysql配置文件目录(/etc/mysql)
-DINSTALL_PLUGINDIR=lib/mysql/plugin 指向插件目录(prefix/lib/mysql/plugin)
-DINSTALL_MANDIR=share/man 指向man文档目录(prefix/share/man)
-DINSTALL_SHAREDIR=share 指向aclocal/mysql.m4安装目录(prefix/share)
-DINSTALL_LIBDIR=lib/mysql 指向对象代码库目录(prefix/lib/mysql)
-DINSTALL_INCLUDEDIR=include/mysql 指向头文件目录(prefix/include/mysql)
-DINSTALL_INFODIR=share/info 指向info文档存放目录(prefix/share/info)
prefix官方推荐设为/usr
Storage Engine相关
类型csv,myisam,myisammrg,heap,innobase,archive,blackhole
若想启用某个引擎的支持:-DWITH_<ENGINE>_STORAGE_ENGINE=1
如:
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
若想禁用某个引擎的支持:-DWITHOUT_<ENGINE>_STORAGE_ENGINE=1
如:
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1
Library相关
-DWITH_READLINE=1 启用readline库支持(提供可编辑的命令行)
-DWITH_SSL=system 启用ssl库支持(安全套接层)
-DWITH_ZLIB=system 启用libz库支持(zib、gzib相关)
-DWTIH_LIBWRAP=0 禁用libwrap库(实现了通用TCP包装的功能,为网络服务守护进程使用)
-DMYSQL_TCP_PORT=3306 指定TCP端口为3306
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock 指定mysql.sock路径
-DENABLED_LOCAL_INFILE=1 启用本地数据导入支持
-DEXTRA_CHARSETS=all 启用额外的字符集类型(默认为all)
-DDEFAULT_CHARSET=utf8 指定默认的字符集为utf8
-DDEFAULT_COLLATION=utf8_general_ci 设定默认排序规则(utf8_general_ci快速/utf8_unicode_ci准确)
-DWITH_EMBEDDED_SERVER=1 编译嵌入式服务器支持
-DMYSQL_USER=mysql 指定mysql用户(默认为mysql)
-DWITH_DEBUG=0 禁用debug(默认为禁用)
-DENABLE_PROFILING=0 禁用Profiling分析(默认为开启)
-DWITH_COMMENT='string' 一个关于编译环境的描述性注释

--------------------------------make-----------------------------

make
根据Makefile文件编译源代码、连接、生成目标文件、可执行文件。
make clean
清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件。
make install
将编译成功的可执行文件安装到系统目录中,一般为/usr/local/bin目录。
make dist
产生发布软件包文件(即distribution package)。这个命令将会将可执行文件及相关文件打包成一个tar.gz压缩的文件用来作为发布软件的软件包。
它会在当前目录下生成一个名字类似“PACKAGE-VERSION.tar.gz”的文件。PACKAGE和VERSION,是我们在configure.in中定义的AM_INIT_AUTOMAKE(PACKAGE, VERSION)。
make distcheck
生成发布软件包并对其进行测试检查,以确定发布包的正确性。这个操作将自动把压缩包文件解开,然后执行configure命令,并且执行make,来确认编译不出现错误,最后提示你软件包已经准备好,可以发布了。
make distclean
类似make clean,但同时也将configure生成的文件全部删除掉,包括Makefile文件。