博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux下,安装mysql-5.5.25.tar.gz源码包全过程
阅读量:6082 次
发布时间:2019-06-20

本文共 12634 字,大约阅读时间需要 42 分钟。

  hot3.png

首先下载所需的mysql安装包和cmake编译包文件,版本如下: 

[root@test01 ~]# mkdir -p /mysql/data
[root@test01 ~]# cd /mysql[root@test01 ~]# ll-rw-r--r--  1 root root  5477628 6月  16 20:04 cmake-2.8.4.tardrwxr-xr-x  2 root root     4096 6月  16 19:46 data-rw-r--r--  1 root root 24639871 6月  16 19:47 mysql-5.5.25.tar.gz
[root@test01 mysql]# cd cmake-2.8.4[root@test01 cmake-2.8.4]# makeScanning dependencies of target cmsys[  1%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/ProcessUNIX.o....####中间省略####Scanning dependencies of target CMakeLibTests[ 99%] Building CXX object Tests/CMakeLib/CMakeFiles/CMakeLibTests.dir/CMakeLibTests.o[ 99%] Building CXX object Tests/CMakeLib/CMakeFiles/CMakeLibTests.dir/testUTF8.o[ 99%] Building CXX object Tests/CMakeLib/CMakeFiles/CMakeLibTests.dir/testXMLParser.o[100%] Building CXX object Tests/CMakeLib/CMakeFiles/CMakeLibTests.dir/testXMLSafe.oLinking CXX executable CMakeLibTests[100%] Built target CMakeLibTests[root@test01 cmake-2.8.4]# make install[  5%] Built target cmsys[  5%] Built target cmsysTestDynload....####中间省略####-- Installing: /mysql/cmake/doc/cmake-2.8/cpack.txt-- Installing: /mysql/cmake/doc/cmake-2.8/cpack.docbook[root@test01 cmake-2.8.4]# cd /mysql/cmake/bin/[root@test01 bin]# ll总用量 25844-rwxr-xr-x 1 root root 7990418 6月  16 20:15 cmake-rwxr-xr-x 1 root root 8555095 6月  16 20:15 cpack-rwxr-xr-x 1 root root 9912848 6月  16 20:15 ctest[root@test01 bin]#
[root@test01 mysql]# tar xvzf mysql-5.5.25.tar.gz mysql-5.5.25/mysql-5.5.25/COPYINGmysql-5.5.25/extra/mysql-5.5.25/extra/replace.cmysql-5.5.25/extra/yassl/mysql-5.5.25/extra/yassl/COPYINGmysql-5.5.25/extra/yassl/lib/mysql-5.5.25/extra/yassl/lib/dummymysql-5.5.25/extra/yassl/AUTHORSmysql-5.5.25/extra/yassl/taocrypt/mysql-5.5.25/extra/yassl/taocrypt/COPYING.....###省略...
[root@test01 mysql]# cd mysql-5.5.25 [root@test01 mysql-5.5.25]# /mysql/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/mysql \> -DMYSQL_UNIX_ADDR=/mysql/data/mysql.sock \> -DDEFAULT_CHARSET=utf8 \> -DDEFAULT_COLLATION=utf8_general_ci \> -DWITH_MYISAM_STORAGE_ENGINE=1 \> -DWITH_INNOBASE_STORAGE_ENGINE=1 \> -DWITH_MEMORY_STORAGE_ENGINE=1 \> -DWITH_READLINE=1 \> -DENABLED_LOCAL_INFILE=1 \> -DMYSQL_DATADIR=/mysql/data \> -DMYSQL_USER=mysql \> -DMYSQL_TCP_PORT=3306
######cmake后会报缺少包的错误-- 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-- Looking for SHM_HUGETLB-- Looking for SHM_HUGETLB - found....##中间省略....-- Check size of wctype_t - done-- Check size of wint_t-- Check size of wint_t - done-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:83 (MESSAGE):  Curses library not found.  Please install appropriate package,      remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.Call Stack (most recent call first):  cmake/readline.cmake:118 (FIND_CURSES)  cmake/readline.cmake:214 (MYSQL_USE_BUNDLED_READLINE)  CMakeLists.txt:268 (MYSQL_CHECK_READLINE)-- Configuring incomplete, errors occurred!
###这里我们解决一下上面缺少包的问题###[root@test01 mysql-5.5.25]# yum -y install ncurses-develLoaded plugins: product-id, refresh-packagekit, security, subscription-managerUpdating certificate-based repositories.Unable to read consumer identityfile:///media/Server/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/Server/repodata/repomd.xmlTrying other mirror.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package ncurses-devel.x86_64 0:5.7-3.20090208.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved================================================================================================================== Package                      Arch                  Version                           Repository             Size==================================================================================================================Installing: ncurses-devel                x86_64                5.7-3.20090208.el6                server                642 kTransaction Summary==================================================================================================================Install       1 Package(s)Total download size: 642 kInstalled size: 1.7 MDownloading Packages:Error Downloading Packages:  ncurses-devel-5.7-3.20090208.el6.x86_64: failure: ../Packages/ncurses-devel-5.7-3.20090208.el6.x86_64.rpm from server: [Errno 256] No more mirrors to try.[root@test01 mysql-5.5.25]#
###网上下载一下ncurses-devel-5.7-3.20090208.el6.x86_64.rpm###[root@test01 mysql]# wget http://dl.download.csdn.net/down11/20170213/fa12609447e77d5a50e95bcb9c5662bd.rpm?response-content-disposition=attachment%3Bfilename%3D%22ncurses-devel-5.7-3.20090208.el6.x86_64.rpm%22&OSSAccessKeyId=9q6nvzoJGowBj4q1&Expires=1497622791&Signature=ukfYp4NJhDMQxJe7nBOnxnhCFgk%3D[root@test01 mysql]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm warning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 1d1e034b: NOKEYPreparing...                ########################################### [100%]   1:ncurses-devel          ########################################### [100%][root@test01 mysql]# makemake: *** [root@test01 mysql]#  yum -y install ncurses-develLoaded plugins: product-id, refresh-packagekit, security, subscription-managerUpdating certificate-based repositories.Unable to read consumer identityfile:///media/Server/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/Server/repodata/repomd.xmlTrying other mirror.Setting up Install ProcessPackage ncurses-devel-5.7-3.20090208.el6.x86_64 already installed and latest versionNothing to do[root@test01 mysql]# rm CMakeCache.txt
##再执行一下cmake[root@test01 bin]# cd /mysql/mysql-5.5.25/[root@test01 mysql-5.5.25]# /mysql/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/mysql \> -DMYSQL_UNIX_ADDR=/mysql/data/mysql.sock \> -DDEFAULT_CHARSET=utf8 \> -DDEFAULT_COLLATION=utf8_general_ci \> -DWITH_MYISAM_STORAGE_ENGINE=1 \> -DWITH_INNOBASE_STORAGE_ENGINE=1 \> -DWITH_MEMORY_STORAGE_ENGINE=1 \> -DWITH_READLINE=1 \> -DENABLED_LOCAL_INFILE=1 \> -DMYSQL_DATADIR=/mysql/data \> -DMYSQL_USER=mysql \> -DMYSQL_TCP_PORT=3306
-- 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-- Looking for SHM_HUGETLB-- Looking for SHM_HUGETLB - found-- MySQL 5.5.25-- Looking for sys/types.h-- Looking for sys/types.h - found-- Looking for stdint.h-- Looking for stdint.h - found-- Looking for stddef.h-- Looking for stddef.h - found-- Check size of void *-- Check size of void * - done-- Packaging as: mysql-5.5.25-Linux-x86_64-- Looking for floor...###省略....-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success-- Check size of pthread_t-- Check size of pthread_t - done-- Performing Test HAVE_PEERCRED-- Performing Test HAVE_PEERCRED - SuccessWarning: Bison executable not found in PATH-- Configuring done-- Generating doneCMake Warning: The variable, 'MYSQL_USER', specified manually, was not used during the generation.CMake Warning: The variable, 'WITH_MEMORY_STORAGE_ENGINE', specified manually, was not used during the generation.-- Build files have been written to: /mysql/mysql-5.5.25
[root@test01 mysql-5.5.25]# makeScanning dependencies of target INFO_BIN[  0%] Built target INFO_BINScanning dependencies of target INFO_SRC.....[100%] Built target my_safe_process[root@test01 mysql-5.5.25]# make install [  0%] Built target INFO_BIN[  0%] Built target INFO_SRC....-- Installing: /mysql/man/man1/myisamlog.1-- Installing: /mysql/man/man1/mysqlcheck.1-- Installing: /mysql/man/man1/mysql_client_test_embedded.1-- Installing: /mysql/man/man8/mysqld.8[root@test01 mysql-5.5.25]#
[root@test01 mysql-5.5.25]# cd scripts[root@test01 scripts]# chmod 775 mysql_install_db[root@test01 scripts]# ls -l  mysql_install_db-rwxrwxr-x 1 root root 14816 6月  16 20:41 mysql_install_db[root@test01 scripts]#
[root@test01 scripts]# ./mysql_install_db --basedir=/mysql --datadir=/mysql/data --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/mysql/bin/mysqladmin -u root password 'new-password'/mysql/bin/mysqladmin -u root -h test01 password 'new-password'Alternatively you can run:/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /mysql ; /mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /mysql/scripts/mysqlbug script!
[root@test01 scripts]# cd ../support-files[root@test01 support-files]# cp mysql.server mysqld[root@test01 support-files]# sh mysqld startStarting MySQL..The server quit without updating PID file ([失败]ib/mysql/test01.pid).
[root@test01 support-files]#  cat /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[root@test01 data]# vi /etc/my.cnf[mysqld]datadir=/mysql/datasocket=/mysql/data/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# 忽略表大小写lower_case_table_names=1[mysqld_safe]log-error=/mysql/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid
[root@test01 scripts]# ./mysql_install_db --basedir=/mysql --datadir=/mysql/data --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/mysql/bin/mysqladmin -u root password 'new-password'/mysql/bin/mysqladmin -u root -h test01 password 'new-password'Alternatively you can run:/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /mysql ; /mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /mysql/scripts/mysqlbug script![root@test01 scripts]# cd ../support-files[root@test01 support-files]# sh mysqld startStarting MySQL..                                           [确定][root@test01 support-files]#
[root@test01 bin]# ./mysql -u root -h localhost -p###这里直接敲回车Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.5.25 Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create user root identified by '******';Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on *.* to root;Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.00 sec)

 

转载于:https://my.oschina.net/90888/blog/974065

你可能感兴趣的文章
Java知多少(61)线程优先级
查看>>
Linux-HA实战(3)— 基于Pacemaker搭建TFS Nameserver HA
查看>>
Java和H5前端区别
查看>>
hdu6049
查看>>
Java多线程系列目录
查看>>
冷门_可变参数方法
查看>>
powerdesigner 外键生成sql语句设置在创建表里面
查看>>
Android之Monkey全参数(包含隐藏参数)
查看>>
可变参数
查看>>
搭建LoadRunner中的场景(三)场景的执行计划
查看>>
[开源]KJFramework.Message 智能二进制消息框架 -- 对于数组的极致性优化
查看>>
Android SDK与ADT版本不匹配的解决
查看>>
ehcache缓存的简单使用
查看>>
tomcat内存溢出
查看>>
DFS Codeforces Round #290 (Div. 2) B. Fox And Two Dots
查看>>
POJ3581:Sequence——题解
查看>>
BZOJ4009 & 洛谷3242 & LOJ2113:[HNOI2015]接水果——题解
查看>>
用dom4j解析xml文件并执行增删改查操作
查看>>
Shell脚本排序总结
查看>>
C++ map<char *,int>
查看>>