1.安裝cmake包html
[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用戶信息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.編譯安裝mysqlweb
[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%的時候會報錯sql
注意:若是從新編譯或者編譯出錯了,須要清除舊的對象文件和緩存信息。 數據庫
# make clean bootstrap
# rm -f CMakeCache.txt vim
# 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_<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文件。