1.安装cmake包
[root@edu soft]# tar -xzf cmake-3.0.0.tar.Z [root@edu soft]# cd cmake-3.0.0 [root@edu cmake-3.0.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.0 --------------------------------------------- CMake has bootstrapped. Now run gmake.
[root@edu cmake-3.0.0]# gmake #配置完成后进行编译 ...... [ 99%] Building CXX object Tests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o Linking CXX executable runcompilecommands [ 99%] Built target runcompilecommands Scanning dependencies of target foo [ 99%] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o Linking CXX static library libfoo.a [ 99%] Built target foo Scanning dependencies of target memcheck_fail [ 99%] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/memcheck_fail.dir/ret1.cxx.o Linking CXX executable memcheck_fail [ 99%] Built target memcheck_fail Scanning dependencies of target pseudo_BC [ 99%] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_BC.dir/ret0.cxx.o Linking CXX executable BC [ 99%] Built target pseudo_BC Scanning dependencies of target pseudo_purify [ 99%] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_purify.dir/ret0.cxx.o Linking CXX executable purify [ 99%] Built target pseudo_purify Scanning dependencies of target pseudo_valgrind [100%] Building CXX object Tests/CTestTestMemcheck/CMakeFiles/pseudo_valgrind.dir/ret0.cxx.o Linking CXX executable valgrind [100%] Built target pseudo_valgrind Scanning dependencies of target pseudonl_BC [100%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_BC.dir/ret0.c.o Linking C executable BC [100%] Built target pseudonl_BC Scanning dependencies of target pseudonl_purify [100%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_purify.dir/ret0.c.o Linking C executable purify [100%] Built target pseudonl_purify Scanning dependencies of target pseudonl_valgrind [100%] Building C object Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeFiles/pseudonl_valgrind.dir/ret0.c.o Linking C executable valgrind [100%] Built target pseudonl_valgrind
[root@edu cmake-3.0.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 49 -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 8 drwxr-xr-x 2 mysql mysql 4096 Feb 1 12:44 data drwxr-xr-x 2 mysql mysql 4096 Feb 1 12:44 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.19 [root@edu mysql-5.6.19]# 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=1 \ > -DWITH_INNOBASE_STORAGE_ENGINE=1 \ > -DWITH_MEMORY_STORAGE_ENGINE=1 \ > -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ > -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ > -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 \ > -DWITH_READLINE=1 \ > -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ > -DMYSQL_TCP_PORT=3306 \ > -DENABLED_LOCAL_INFILE=1 \ > -DEXTRA_CHARSETS=all \ > -DDEFAULT_CHARSET=utf8 \ > -DWITH_SSL=yes \ > -DDEFAULT_COLLATION=utf8_general_ci ......
[root@edu cmake-3.0.0]# make ....... [ 99%] Generating mysqlserver_depends.c Scanning dependencies of target mysqlserver [ 99%] 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.19/libmysqld//libmysqld.a [ 99%] Built target mysqlserver Scanning dependencies of target mysql_client_test_embedded [ 99%] Building C object libmysqld/examples/CMakeFiles/mysql_client_test_embedded.dir/__/__/tests/mysql_client_test.c.o Linking CXX executable mysql_client_test_embedded [ 99%] Built target mysql_client_test_embedded Scanning dependencies of target mysql_embedded [ 99%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o [ 99%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o /root/mysql-5.6.19/client/mysql.cc:1555: warning: dereferencing type-punned pointer will break strict-aliasing rules /root/mysql-5.6.19/client/mysql.cc:1555: warning: dereferencing type-punned pointer will break strict-aliasing rules [100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o Linking CXX executable mysql_embedded [100%] Built target mysql_embedded Scanning dependencies of target mysqltest_embedded [100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o /root/mysql-5.6.19/client/mysqltest.cc: In function 鈥榗har* re_eprint(int)鈥? /root/mysql-5.6.19/client/mysqltest.cc:8236: warning: unused variable 鈥榣en鈥? Linking CXX executable mysqltest_embedded [100%] Built target mysqltest_embedded Scanning dependencies of target my_safe_process [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
编译的可能会报错,要注意内存的大小,去掉-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.0]# make install ...... -- Installing: /usr/local/mysql/man/man1/myisam_ftdump.1 -- Installing: /usr/local/mysql/man/man1/mysql_install_db.1 -- Installing: /usr/local/mysql/man/man1/mysql_config.1 -- Installing: /usr/local/mysql/man/man1/mysql_tzinfo_to_sql.1 -- Installing: /usr/local/mysql/man/man1/mysqlbug.1 -- Installing: /usr/local/mysql/man/man1/mysql_upgrade.1 -- Installing: /usr/local/mysql/man/man1/mysqlshow.1 -- Installing: /usr/local/mysql/man/man1/myisamchk.1 -- Installing: /usr/local/mysql/man/man1/mysql_find_rows.1 -- Installing: /usr/local/mysql/man/man1/mysqlcheck.1 -- Installing: /usr/local/mysql/man/man1/mysqlimport.1 -- Installing: /usr/local/mysql/man/man1/innochecksum.1 -- Installing: /usr/local/mysql/man/man1/mysqld_safe.1 -- Installing: /usr/local/mysql/man/man1/msql2mysql.1 -- Installing: /usr/local/mysql/man/man1/mysql_client_test.1 -- Installing: /usr/local/mysql/man/man1/mysql_plugin.1 -- Installing: /usr/local/mysql/man/man1/mysql_client_test_embedded.1 -- Installing: /usr/local/mysql/man/man1/mysql_secure_installation.1 -- Installing: /usr/local/mysql/man/man1/mysql.server.1 -- Installing: /usr/local/mysql/man/man1/mysql_fix_extensions.1 -- Installing: /usr/local/mysql/man/man1/resolve_stack_dump.1 -- Installing: /usr/local/mysql/man/man1/mysql-stress-test.pl.1 -- Installing: /usr/local/mysql/man/man1/mysql.1 -- Installing: /usr/local/mysql/man/man1/mysqladmin.1 -- Installing: /usr/local/mysql/man/man1/mysql-test-run.pl.1 -- Installing: /usr/local/mysql/man/man1/mysql_convert_table_format.1 -- Installing: /usr/local/mysql/man/man1/my_print_defaults.1 -- Installing: /usr/local/mysql/man/man1/mysqldump.1 -- Installing: /usr/local/mysql/man/man1/mysql_setpermission.1 -- Installing: /usr/local/mysql/man/man1/mysqlhotcopy.1 -- Installing: /usr/local/mysql/man/man1/perror.1 -- Installing: /usr/local/mysql/man/man8/mysqld.8
[root@edu mysql]# ll /usr/local/mysql/ total 160 drwxr-xr-x 2 root root 4096 Feb 1 15:43 bin -rw-r--r-- 1 root root 17987 May 6 2014 COPYING drwxr-xr-x 3 root root 4096 Feb 1 15:42 data drwxr-xr-x 2 root root 4096 Feb 1 15:42 docs drwxr-xr-x 3 root root 4096 Feb 1 15:42 include -rw-r--r-- 1 root root 89163 May 6 2014 INSTALL-BINARY drwxr-xr-x 3 root root 4096 Feb 1 15:42 lib drwxr-xr-x 4 root root 4096 Feb 1 15:43 man drwxr-xr-x 10 root root 4096 Feb 1 15:43 mysql-test -rw-r--r-- 1 root root 2496 May 6 2014 README drwxr-xr-x 2 root root 4096 Feb 1 15:43 scripts drwxr-xr-x 28 root root 4096 Feb 1 15:43 share drwxr-xr-x 4 root root 4096 Feb 1 15:43 sql-bench drwxr-xr-x 2 root root 4096 Feb 1 15:43 support-files
4.修改配置
[root@edu mysql-5.6.19]# cp support-files/my-default.cnf /etc/my.cnf [root@edu mysql-5.6.19]# 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 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 # 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.19]#
4.初始化数据库
[root@edu mysql-5.6.19]# /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.19]#
系统只提示Installing MySQL system tables...就结束了,感觉不正常,查看系统日志:
[root@edu log]# tail -f mysql_error.log 2016-02-01 16:39:16 14116 [Note] InnoDB: Using mutexes to ref count buffer pool pages 2016-02-01 16:39:16 14116 [Note] InnoDB: The InnoDB memory heap is disabled 2016-02-01 16:39:16 14116 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation 2016-02-01 16:39:16 14116 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-02-01 16:39:16 14116 [Note] InnoDB: Using Linux native AIO 2016-02-01 16:39:16 14116 [Note] InnoDB: Not using CPU crc32 instructions 2016-02-01 16:39:16 14116 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-02-01 16:39:16 14116 [Note] InnoDB: Completed initialization of buffer pool 2016-02-01 16:39:16 14116 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2016-02-01 16:39:16 14116 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2016-02-01 16:39:16 14116 [Note] InnoDB: Database physically writes the file full: wait... --此处发现空间已满 2016-02-01 16:39:16 b7f2b6d0 InnoDB: Error: Write to file ./ibdata1 failed at offset 0. InnoDB: 1048576 bytes should have been written, only -1 were written. InnoDB: Operating system error number 28. 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 28 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 2016-02-01 16:39:16 14116 [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space 2016-02-01 16:39:16 14116 [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! 2016-02-01 16:39:16 14116 [ERROR] Plugin 'InnoDB' init function returned error. 2016-02-01 16:39:16 14116 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2016-02-01 16:39:16 14116 [ERROR] /usr/loc
[oracle@edu ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 36554508 35078436 0 100% / tmpfs 1037712 0 1037712 0% /dev/shm
发现磁盘空间不足,增加磁盘后将mysql的数据及日志文件挂载到新磁盘,以下为挂载过程(虚拟机):
[root@edu ~]# cd /var/mysql/ [root@edu mysql]# ls data log [root@edu mysql]# ll total 8 drwxr-xr-x 4 mysql mysql 4096 Feb 1 16:39 data drwxr-xr-x 2 mysql mysql 4096 Feb 1 16:39 log [root@edu mysql]# ll -d /var/mysql drwxr-xr-x 4 mysql mysql 4096 Feb 1 12:44 /var/mysql [root@edu mysql]# rm -rf * [root@edu mysql]# vi /etc/fstab LABEL=/ / ext3 defaults 1 1 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda2 swap swap defaults 0 0 /dev/sdb1 /var/mysql ext3 defaults 0 0 ~ "/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 35698 34257 0 100% / tmpfs 1014 0 1014 0% /dev/shm /dev/sdb1 10077 151 9414 2% /var/mysql [root@edu mysql]# mkdir data [root@edu mysql]# mkdir log [root@edu mysql]# ll total 8 drwxr-xr-x 2 root root 4096 Feb 2 08:36 data drwxr-xr-x 2 root root 4096 Feb 2 08:36 log [root@edu mysql]# chown mysql.mysql * [root@edu mysql]# ll total 8 drwxr-xr-x 2 mysql mysql 4096 Feb 2 08:38 data drwxr-xr-x 2 mysql mysql 4096 Feb 2 08:37 log [root@edu mysql]#
然后再清理下/dev/sda1下不用文件,清理下oracle下的归档文件及日志文件:
[oracle@edu archivelog_dest]$ df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/sda1 35698 17766 16091 53% / tmpfs 1014 0 1014 0% /dev/shm /dev/sdb1 10077 151 9414 2% /var/mysql
重新执行mysql_install_db脚本:
[root@edu mysql-5.6.19]# /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.19]# 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 2016-02-02 09:21:00 5875 [Note] InnoDB: Using mutexes to ref count buffer pool pages 2016-02-02 09:21:00 5875 [Note] InnoDB: The InnoDB memory heap is disabled 2016-02-02 09:21:00 5875 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation 2016-02-02 09:21:00 5875 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-02-02 09:21:00 5875 [Note] InnoDB: Using Linux native AIO 2016-02-02 09:21:00 5875 [Note] InnoDB: Not using CPU crc32 instructions 2016-02-02 09:21:00 5875 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-02-02 09:21:00 5875 [Note] InnoDB: Completed initialization of buffer pool 2016-02-02 09:21:00 5875 [Note] InnoDB: Highest supported file format is Barracuda. 2016-02-02 09:21:00 5875 [Note] InnoDB: 128 rollback segment(s) are active. 2016-02-02 09:21:00 5875 [Note] InnoDB: Waiting for purge to start 2016-02-02 09:21:00 5875 [Note] InnoDB: 5.6.19 started; log sequence number 1626037 2016-02-02 09:21:00 5875 [Note] Server hostname (bind-address): '*'; port: 3306 2016-02-02 09:21:00 5875 [Note] IPv6 is available. 2016-02-02 09:21:00 5875 [Note] - '::' resolves to '::'; 2016-02-02 09:21:00 5875 [Note] Server socket created on IP: '::'. 2016-02-02 09:21:00 5875 [ERROR] Can't start server : Bind on unix socket: Permission denied --发现权限应该不对 2016-02-02 09:21:00 5875 [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 2 root root 4096 Feb 1 12:52 mysql/ [root@edu lib]# chown -R mysql.mysql mysql [root@edu lib]# ll -d mysql/ drwxr-xr-x 2 mysql mysql 4096 Feb 1 12:52 mysql/ [root@edu ~]# /etc/init.d/mysqld start Starting MySQL... [ OK ]
6.mysql访问测试
[root@edu ~]# mysqladmin -u root password '123456' [root@edu ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.19-log Source distribution Copyright (c) 2000, 2014, 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.19-log | +------------+ 1 row in set (0.00 sec) mysql> show master logs; +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql_bin.000001 | 69300 | | mysql_bin.000002 | 1237667 | | mysql_bin.000003 | 143 | | mysql_bin.000004 | 143 | | mysql_bin.000005 | 262 | +------------------+-----------+ 5 rows in set (0.00 sec) mysql> exit Bye [root@edu ~]# mysql -V mysql Ver 14.14 Distrib 5.6.19, for Linux (i686) using EditLine wrapper [root@edu ~]# mysql --version mysql Ver 14.14 Distrib 5.6.19, 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_
如:
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
若想禁用某个引擎的支持:-DWITHOUT_
如:
-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文件。