《Mysql學習centos下mysql 5.6.13源碼安裝方法》要點:
本文介紹了Mysql學習centos下mysql 5.6.13源碼安裝方法,希望對您有用。如果有疑問,可以聯系我們。
導讀:2個月前公司給dba的測試服務器被收回去了,一直跟開發用一組db,有些需要測試的小功能,需要不斷重啟db.申請了一個虛擬機,準備安裝最新的5.6....
2個月前公司給dba的測試服務器被收回去了,一直跟開發用一組db,有些需要測試的小功能,需要不斷重啟db.
申請了一個虛擬機,準備安裝最新的5.6.13版本的mysql社區版.
1 download the tar.gz
?MYSQL入門
wget http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.13.tar.gz/from/http://cdn.mysql.com/
2 安裝cmake軟件包
?MYSQL入門
yum install cmake
?
3?create account of mysql
?MYSQL入門
groupadd mysql??????????
useradd -g mysql mysql??????????
autoreconf --force --install
libtoolize --automake --force
automake --force --add-missing
?
4? complie the sources
?MYSQL入門
mkdir -p /data/mbdata
tar -xvf mysql-5.6.13.tar.gz
5 cmake
?time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
[root@472322 mysql-5.6.13]# time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
-- running cmake version 2.6.4
cmake error: cmake was unable to find a build program corresponding to "unix makefiles".? cmake_make_program is not set.? you probably need to select a different build tool.
cmake error: error required internal cmake variable not set, cmake may be not be built correctly.
missing variable is:
cmake_c_compiler_env_var
cmake error: error required internal cmake variable not set, cmake may be not be built correctly.
missing variable is:
cmake_c_compiler
cmake error: could not find cmake module file:/root/mysql-5.6.13/cmakefiles/cmakeccompiler.cmake
cmake error: error required internal cmake variable not set, cmake may be not be built correctly.
missing variable is:
cmake_cxx_compiler_env_var
cmake error: error required internal cmake variable not set, cmake may be not be built correctly.
missing variable is:
cmake_cxx_compiler
cmake error: could not find cmake module file:/root/mysql-5.6.13/cmakefiles/cmakecxxcompiler.cmake
cmake error: cmake_c_compiler not set, after enablelanguage
cmake error: cmake_cxx_compiler not set, after enablelanguage
-- configuring incomplete, errors occurred!
real??? 0m0.017s
user??? 0m0.006s
sys???? 0m0.005sMYSQL入門
6 上一步cmake報錯了,google得知需要重新yum make下
yum install make
ok
再繼續去cmake
?MYSQL入門
[root@472322 mysql-5.6.13]# time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
-- running cmake version 2.6.4
-- the c compiler identification is unknown
-- the cxx compiler identification is unknown
cmake error: your c compiler: "cmake_c_compiler-notfound" was not found.?? please set cmake_c_compiler to a valid compiler path or name.
cmake error: your cxx compiler: "cmake_cxx_compiler-notfound" was not found.?? please set cmake_cxx_compiler to a valid compiler path or name.
-- mysql 5.6.13
-- packaging as: mysql-5.6.13-linux-x86_64
-- could not find threads? (missing:? threads_found)
-- could not find threads? (missing:? threads_found)
-- check if the system is big endian
-- searching 16 bit integer
cmake error at /usr/share/cmake/modules/testbigendian.cmake:31 (message):
? no suitable type found
call stack (most recent call first):
? configure.cmake:621 (test_big_endian)
? cmakelists.txt:314 (include)
?
這個錯誤很詭異,google上面有很多,但是每種情況都不同,我只好一個個去try了
-- configuring incomplete, errors occurred!
real??? 0m0.122s
user??? 0m0.067s
sys???? 0m0.048s
[root@472322 mysql-5.6.13]#
報錯如下: cmake error: your c compiler: "cmake_c_compiler-notfound" was not found.
?沒有安裝 gcc 和 gcc-c++,執行cmake報如上錯誤:
?第一次嘗試,執行
?MYSQL入門
yum install -y gcc
yum install -y gcc-c++
ok,yum成功MYSQL入門
7? 繼續cmake
time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
?MYSQL入門
[root@472322 mysql-5.6.13]#
time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
-- running cmake version 2.6.4
-- the c compiler identification is gnu
-- the cxx compiler identification is gnu
-- check for working c compiler: /usr/bin/gcc
-- check for working c compiler: /usr/bin/gcc -- works
-- detecting c compiler abi info
-- detecting c compiler abi info - done
-- check for working cxx compiler: /usr/bin/c++
-- check for working cxx compiler: /usr/bin/c++ -- works
-- detecting cxx compiler abi info
-- detecting cxx compiler abi info - done
-- mysql 5.6.13
-- packaging as: mysql-5.6.13-linux-x86_64
-- could not find threads? (missing:? threads_found)
-- could not find threads? (missing:? threads_found)
-- check if the system is big endian
-- searching 16 bit integer
cmake error at /usr/share/cmake/modules/testbigendian.cmake:31 (message):
? no suitable type found
call stack (most recent call first):
? configure.cmake:621 (test_big_endian)
? cmakelists.txt:314 (include)
-- configuring incomplete, errors occurred!
real??? 0m0.510s
user??? 0m0.275s
sys???? 0m0.112s
?
第二次嘗試,有人說需要安裝至少5種包
?MYSQL入門
[root@472322 mysql-5.6.13]#
yum install gcc gcc-c++
??? yum install -y ncurses-devel.x86_64
??? yum install -y cmake.x86_64
??? yum install -y libaio.x86_64
??? yum install -y bison.x86_64
yum install -y gcc-c++.x86_64
?
然后再cmake,還是報原來的錯誤?
最后決定用土方法了,刪除所有的已經安裝過的,重新再來做一遍吧.
[解決方法]:刪除原來的mysql-5.6.13目錄,重新解壓縮tar.gz包
?MYSQL入門
rm -rf /root/mysql-5.6.13
cd /root/
tar -xvf mysql-5.6.13.tar.gz
cd /root/mysql-5.6.13
time cmake . -dcmake_install_prefix=/usr/local/mysql56 -dmysql_datadir=/data56 -dwith_innobase_storage_engine=1 -dmysql_unix_addr==/data56/mysql.sock -dmysql_user=mysql -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci
........
-- looking for asprintf
-- looking for asprintf - found
-- check size of pthread_t
-- check size of pthread_t - done
-- using cmake version 2.6.4
-- not building ndb
-- performing test have_peercred
-- performing test have_peercred - success
-- library mysqlclient depends on oslibs -lpthread;m;rt;dl
-- googlemock was not found. gtest-based unit tests will be disabled. you can run cmake . -denable_downloads=1 to automatically download and build required components from source.
-- if you are inside a firewall, you may need to use an http proxy: export http_proxy=http://foo.bar.com:80
-- library mysqlserver depends on oslibs -lpthread;m;rt;crypt;dl
-- configuring done
-- generating done
-- build files have been written to: /root/mysql-5.6.13
real??? 0m23.413s
user??? 0m13.815s
sys???? 0m7.419s
?
ok,成功了,對linux底層不太熟悉,難道是因為前面沒有事先安裝好各種包而cmake出來錯誤的東西導致后面繼續cmake就一直報錯嗎? 是否是需要準備好各種lib包然后才能yum install cmake呢?然后再安裝mysql才能不報錯呢?MYSQL入門
8 build the db directy
?MYSQL入門
time make
time make install
9 init db
?MYSQL入門
ll /usr/local/mysql56/
cd /usr/local/mysql56/
chown -r mysql .
chgrp -r mysql .
cp support-files/my-default.cnf /etc/my56.cnf
scripts/mysql_install_db? --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf
[root@472322 mysql56]# scripts/mysql_install_db? --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf
installing mysql system tables...2013-08-22 05:06:03 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-08-22 05:06:03 19416 [note] innodb: the innodb memory heap is disabled
2013-08-22 05:06:03 19416 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2013-08-22 05:06:03 19416 [note] innodb: compressed tables use zlib 1.2.3
2013-08-22 05:06:03 19416 [note] innodb: using cpu crc32 instructions
2013-08-22 05:06:03 19416 [note] innodb: initializing buffer pool, size = 128.0m
2013-08-22 05:06:03 19416 [note] innodb: completed initialization of buffer pool
2013-08-22 05:06:03 19416 [note] innodb: the first specified data file ./ibdata1 did not exist: a new database to be created!
2013-08-22 05:06:03 19416 [note] innodb: setting file ./ibdata1 size to 12 mb
2013-08-22 05:06:03 19416 [note] innodb: database physically writes the file full: wait...
2013-08-22 05:06:03 19416 [note] innodb: setting log file ./ib_logfile101 size to 48 mb
2013-08-22 05:06:03 19416 [note] innodb: setting log file ./ib_logfile1 size to 48 mb
2013-08-22 05:06:03 19416 [note] innodb: renaming log file ./ib_logfile101 to ./ib_logfile0
2013-08-22 05:06:03 19416 [warning] innodb: new log files created, lsn=45781
2013-08-22 05:06:03 19416 [note] innodb: doublewrite buffer not found: creating new
2013-08-22 05:06:03 19416 [note] innodb: doublewrite buffer created
2013-08-22 05:06:03 19416 [note] innodb: 128 rollback segment(s) are active.
2013-08-22 05:06:03 19416 [warning] innodb: creating foreign key constraint system tables.
2013-08-22 05:06:03 19416 [note] innodb: foreign key constraint system tables created
2013-08-22 05:06:03 19416 [note] innodb: creating tablespace and datafile system tables.
2013-08-22 05:06:03 19416 [note] innodb: tablespace and datafile system tables created.
2013-08-22 05:06:03 19416 [note] innodb: waiting for purge to start
2013-08-22 05:06:03 19416 [note] innodb: 5.6.13 started; log sequence number 0
2013-08-22 05:06:04 19416 [note] binlog end
2013-08-22 05:06:04 19416 [note] innodb: fts optimize thread exiting.
2013-08-22 05:06:04 19416 [note] innodb: starting shutdown...
2013-08-22 05:06:05 19416 [note] innodb: shutdown completed; log sequence number 1625977
ok
filling help tables...2013-08-22 05:06:05 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-08-22 05:06:05 19439 [note] innodb: the innodb memory heap is disabled
2013-08-22 05:06:05 19439 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2013-08-22 05:06:05 19439 [note] innodb: compressed tables use zlib 1.2.3
2013-08-22 05:06:05 19439 [note] innodb: using cpu crc32 instructions
2013-08-22 05:06:05 19439 [note] innodb: initializing buffer pool, size = 128.0m
2013-08-22 05:06:05 19439 [note] innodb: completed initialization of buffer pool
2013-08-22 05:06:05 19439 [note] innodb: highest supported file format is barracuda.
2013-08-22 05:06:05 19439 [note] innodb: 128 rollback segment(s) are active.
2013-08-22 05:06:05 19439 [note] innodb: waiting for purge to start
2013-08-22 05:06:05 19439 [note] innodb: 5.6.13 started; log sequence number 1625977
2013-08-22 05:06:05 19439 [note] binlog end
2013-08-22 05:06:05 19439 [note] innodb: fts optimize thread exiting.
2013-08-22 05:06:05 19439 [note] innodb: starting shutdown...
2013-08-22 05:06:06 19439 [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/local/mysql56/bin/mysqladmin -u root password 'new-password'
? /usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com password 'new-password'
alternatively you can run:
? /usr/local/mysql56/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/mysql56/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 with the ./bin/mysqlbug script!
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/local/mysql56/my.cnf and
will be used by default by the server when you start it.
you may edit this file to change server settings
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
感到信息有warning,那就重新再執行一遍,原來在做5.6.10安裝測試的時候,init db不管第一次執行失敗或者成功,都可以再執行第二遍的.
[root@472322 mysql56]#
[root@472322 mysql56]# ll etc/my56.cnf
ls: cannot access etc/my56.cnf: no such file or directory
[root@472322 mysql56]# ll /etc/my56.cnf
-rw-r--r-- 1 root root 1126 aug 22 05:05 /etc/my56.cnf
[root@472322 mysql56]# scripts/mysql_install_db? --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf
installing mysql system tables...2013-08-22 05:07:31 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-08-22 05:07:31 19481 [note] innodb: the innodb memory heap is disabled
2013-08-22 05:07:31 19481 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2013-08-22 05:07:31 19481 [note] innodb: compressed tables use zlib 1.2.3
2013-08-22 05:07:31 19481 [note] innodb: using cpu crc32 instructions
2013-08-22 05:07:31 19481 [note] innodb: initializing buffer pool, size = 128.0m
2013-08-22 05:07:31 19481 [note] innodb: completed initialization of buffer pool
2013-08-22 05:07:31 19481 [note] innodb: highest supported file format is barracuda.
2013-08-22 05:07:31 19481 [note] innodb: 128 rollback segment(s) are active.
2013-08-22 05:07:31 19481 [note] innodb: waiting for purge to start
2013-08-22 05:07:31 19481 [note] innodb: 5.6.13 started; log sequence number 1625987
2013-08-22 05:07:31 19481 [note] binlog end
2013-08-22 05:07:31 19481 [note] innodb: fts optimize thread exiting.
2013-08-22 05:07:31 19481 [note] innodb: starting shutdown...
2013-08-22 05:07:32 19481 [note] innodb: shutdown completed; log sequence number 1625997
ok
filling help tables...2013-08-22 05:07:32 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-08-22 05:07:32 19505 [note] innodb: the innodb memory heap is disabled
2013-08-22 05:07:32 19505 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2013-08-22 05:07:32 19505 [note] innodb: compressed tables use zlib 1.2.3
2013-08-22 05:07:32 19505 [note] innodb: using cpu crc32 instructions
2013-08-22 05:07:32 19505 [note] innodb: initializing buffer pool, size = 128.0m
2013-08-22 05:07:32 19505 [note] innodb: completed initialization of buffer pool
2013-08-22 05:07:32 19505 [note] innodb: highest supported file format is barracuda.
2013-08-22 05:07:32 19505 [note] innodb: 128 rollback segment(s) are active.
2013-08-22 05:07:32 19505 [note] innodb: waiting for purge to start
2013-08-22 05:07:32 19505 [note] innodb: 5.6.13 started; log sequence number 1625997
2013-08-22 05:07:32 19505 [note] binlog end
2013-08-22 05:07:32 19505 [note] innodb: fts optimize thread exiting.
2013-08-22 05:07:32 19505 [note] innodb: starting shutdown...
2013-08-22 05:07:34 19505 [note] innodb: shutdown completed; log sequence number 1626007
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/mysql56/bin/mysqladmin -u root password 'new-password'
? /usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com password 'new-password'
alternatively you can run:
? /usr/local/mysql56/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/mysql56/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 with the ./bin/mysqlbug script!
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/mysql56/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/mysql56/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
10 copy start command
cp support-files/mysql.server /etc/init.d/mysqld56
chmod 700 /etc/init.d/mysqld56
echo "export path=$path:/usr/local/mysql56/bin">>/etc/profile
source /etc/profile
11 add command to system parameter
cd /data56
chkconfig --add mysqld56
12? start service & check & login
service mysqld56 start
[root@472322 data56]# service mysqld56 start
starting mysql. success!
[root@472322 data56]# mysql
welcome to the mysql monitor.? commands end with ; or g.
your mysql connection id is 1
server version: 5.6.13 source distribution
copyright (c) 2000, 2013, 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> show databases;
+--------------------+
| database?????????? |
+--------------------+
| information_schema |
| mysql????????????? |
| performance_schema |
| test?????????????? |
+--------------------+
4 rows in set (0.00 sec)
mysql>
?
總結疑問:對linux底層不太熟悉,難道是因為前面沒有事先安裝好各種包而cmake出來錯誤的東西導致后面繼續cmake就一直報錯嗎?
是否是需要準備好各種lib包然后才能yum install cmake呢?
然后再安裝mysql才能不報錯呢?
CentOS 6.3下源碼編譯安裝MySQL 5.6
CentOS 6.5編譯安裝Percona 5.6.15(步驟)
centos6.4編譯安裝mysql5.5及Sphinx引擎的辦法詳解
mysql編譯安裝及多實例安裝的辦法分享
fedroa中編譯安裝mysql5.5的實例參考MYSQL入門
歡迎參與《Mysql學習centos下mysql 5.6.13源碼安裝方法》討論,分享您的想法,維易PHP學院為您提供專業教程。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/8888.html