linux下,安装mysql-5.5.25.tar.gz源码包全过程

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

cmake-2.8.4.tar
mysql-5.5.25.tar.gz
ncurses-devel-5.7-3.20090208.el6.x86_64.rpm

[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.tar
drwxr-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]# make
Scanning 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.o
Linking 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/COPYING
mysql-5.5.25/extra/
mysql-5.5.25/extra/replace.c
mysql-5.5.25/extra/yassl/
mysql-5.5.25/extra/yassl/COPYING
mysql-5.5.25/extra/yassl/lib/
mysql-5.5.25/extra/yassl/lib/dummy
mysql-5.5.25/extra/yassl/AUTHORS
mysql-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-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
file:///media/Server/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/Server/repodata/repomd.xml
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.7-3.20090208.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                      Arch                  Version                           Repository             Size
==================================================================================================================
Installing:
 ncurses-devel                x86_64                5.7-3.20090208.el6                server                642 k

Transaction Summary
==================================================================================================================
Install       1 Package(s)

Total download size: 642 k
Installed size: 1.7 M
Downloading 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: NOKEY
Preparing...                ########################################### [100%]
   1:ncurses-devel          ########################################### [100%]
[root@test01 mysql]# make
make: *** 
[root@test01 mysql]#  yum -y install ncurses-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
file:///media/Server/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/Server/repodata/repomd.xml
Trying other mirror.
Setting up Install Process
Package ncurses-devel-5.7-3.20090208.el6.x86_64 already installed and latest version
Nothing 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 - Success
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
CMake 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]# make
Scanning dependencies of target INFO_BIN
[  0%] Built target INFO_BIN
Scanning 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=mysql
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:

/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_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 /mysql ; /mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /mysql/mysql-test ; perl mysql-test-run.pl

Please 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 start
Starting MySQL..The server quit without updating PID file ([失败]ib/mysql/test01.pid).
[root@test01 support-files]#  cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@test01 data]# vi /etc/my.cnf

[mysqld]
datadir=/mysql/data
socket=/mysql/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# 忽略表大小写
lower_case_table_names=1

[mysqld_safe]
log-error=/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@test01 scripts]# ./mysql_install_db --basedir=/mysql --datadir=/mysql/data --user=mysql
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:

/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_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 /mysql ; /mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /mysql/scripts/mysqlbug script!
[root@test01 scripts]# cd ../support-files
[root@test01 support-files]# sh mysqld start
Starting 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 3
Server version: 5.5.25 Source distribution

Copyright (c) 2000, 2011, 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> 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值