在startos搭建LAMP之安装mysql

来源:互联网 发布:.top域名怎么样 编辑:程序博客网 时间:2024/06/05 23:50
一、获取mysql的源码安装包
在mysql的官网上有多个版本,我不知道该选择哪个。先胡乱地选择这个
http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-linux-glibc2.5-i686.tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-linux-glibc2.5-i686.tar.gz
这个可能是二进制版本的,我要下载源码安装包
http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz
二、安装cmake
1.从mysql5.5以后不再使用原来的先运行configure进行配置并生成makefile,而是使用cmake的方式进行编译。
使用命令whereis cmake查处cmake在/usr/lib/cmake。
使用cmake --help
提示信息:bash: cmake: command not found
2.下载cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
将cmake安装到默认目录
./configure
提示信息:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CURSES_CURSES_H_PATH
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source/CursesDialog/form
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source


-- Configuring incomplete, errors occurred!
See also "/home/cg/Downloads/cmake/cmake-2.8.12.1/CMakeFiles/CMakeOutput.log".
See also "/home/cg/Downloads/cmake/cmake-2.8.12.1/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
执行另外的命令来安装cmake:
./bootstrap
提示信息:
-- Found unsuitable Qt version "" from NOTFOUND
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CURSES_CURSES_H_PATH
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source/CursesDialog/form
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source
   used as include directory in directory /home/cg/Downloads/cmake/cmake-2.8.12.1/Source


-- Configuring incomplete, errors occurred!
See also "/home/cg/Downloads/cmake/cmake-2.8.12.1/CMakeFiles/CMakeOutput.log".
See also "/home/cg/Downloads/cmake/cmake-2.8.12.1/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
不能成功从源码安装cmake,下载binary版的试一试,执行命令:
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1-Linux-i386.tar.gz
将binary包复制到了/usr/lib/cmake/,并且改名为cmake。

运行下面的命令配置环境变量:

          $export PATH=/usr/lib/cmake/cmake/bin:$PATH

提示信息:

bash: PATH=/usr/lib/cmake/cmake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bin: No such file or directory

删除上面的提示信息中不存在的环境变量目录/usr/games:/opt/bin,通过下面的操作:
将/etc/profile中的path修改为
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin
执行命令echo $PATH,输出结果仍然是:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bin
重启电脑再看结果,执行命令
echo $PATH
输出的结果仍然和profile中的path值不一样,而且,root身份下查看到的path值和cg身份下查看到的path值不一样。查了一些资料,修改path是一个很麻烦的问题,网络资料说最好不要修改/etc/profile的值,而要修改~/.bashsrc的值。暂时跳过这个问题,用一个折衷的办法来解决这个问题,方法是:将/etc/profile的值恢复到默认状态,然后建立该文件中的path值中不存在的目录。
命令mkdir /opt/bin
mkdir /usr/games;mkdir /usr/games/bin
没有看到/usr/X11R7/bin,不建立这个目录,因为网络资料表明:这个X11R7和很多系统配置有关,我不敢妄动。
再执行命令:
export PATH=/usr/lib/cmake/cmake/bin:$PATH
echo $PATH,输出结果:
/usr/lib/cmake/cmake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bin
但是我查看/etc/profile,发现path值没有加进/usr/lib/cmake/cmake/bin,这是怎么回事?而且,输出和/etc/profile中的path值还有其他的不同点。先跳过这个疑点。
执行命令:
cmake --help
在不同的终端窗口得到是不同的输出信息,只有一个表明cmake的path设置生效了,其他的均显示无效。
重启电脑,再看结果。
仍然无效。尝试新的方法,修改/etc/profile中的path值,改为:
export PATH=/usr/lib/cmake/cmake/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/opt/bin:/usr/games/bin
重启电脑。
cg身份,执行命令
echo $PATH
输出信息:
/usr/lib/cmake/cmake/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/opt/bin:/usr/games/bin:/opt/java/jre/bin
对/etc/profile的path值设置生效了。
执行命令:
cmake --help
输出的信息表明:成功了。
root身份,执行命令
echo $PATH
输出信息:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bin
对/etc/profile的path值设置无效。
执行命令:
cmake --help
输出的信息:
bash: cmake: command not found
失败了。
root身份执行命令:
export PATH=/usr/lib/cmake/cmake/bin:$PATH
echo $PATH
输出信息:
/usr/lib/cmake/cmake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bin
生效了
cmake
输出信息进一步表明:export PATH=/usr/lib/cmake/cmake/bin:$PATH 命令生效了。这是否说明:对root用户,path值只能临时设定?或者,要在/etc/profile中对path值的设定加进一个if语句才能永久设定?
三、安装mysql
1.进入mysql的源码包目录,执行命令:
$cmake . -DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql
输出信息:
bash: .: -D: invalid option
.: usage: . filename [arguments]
将命令修改为:
$cmake --DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql
输出信息:
bash: --DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql: No such file or directory
尝试一下来自mysql官网的安装命令:http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html
groupadd mysql
useradd -r -g mysql mysql
# Beginning of source-build specific instructions #tar zxvf mysql-VERSION.tar.gz 
cd mysql-VERSION 
cmake .
输出信息:
-- Could NOT find Curses (missing:  CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:85 (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:128 (FIND_CURSES)
  cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:401 (MYSQL_CHECK_EDITLINE)




-- Configuring incomplete, errors occurred!
See also "/home/cg/Downloads/mysql/mysql-5.6.15/CMakeFiles/CMakeOutput.log".
See also "/home/cg/Downloads/mysql/mysql-5.6.15/CMakeFiles/CMakeError.log".

缺少Curses,下载libncurses5-dev
搜索到了这么一个网址,上面的内容好像就是libncurses5-dev,但是我不知道该选择哪一个。先试一下这个
http://ftp.cn.debian.org/debian/pool/main/n/ncurses/libncurses5-dev_5.9-10_i386.deb
wget http://ftp.cn.debian.org/debian/pool/main/n/ncurses/libncurses5-dev_5.9-10_i386.deb
失败了,试一下这个
http://ftp.tw.debian.org/debian/pool/main/n/ncurses/libncurses5-dev_5.9-10_i386.deb
wget http://ftp.tw.debian.org/debian/pool/main/n/ncurses/libncurses5-dev_5.9-10_i386.deb
失败了,直接通过浏览器下载
前面可能弄错了,现在,下载ncurses
地址:
http://packages.debian.org/wheezy/libncurses5-dev
http://ftp.de.debian.org/debian/pool/main/n/ncurses/ncurses_5.9.orig.tar.gz
在安装ncurses之前,先检测系统是否安装了ncurses,检测方法如下:
进入/usr/lib下查找是否有libncurses.so这个库,也可以man
initscr()看我们需要的函数存在不存在
经检测,系统已经安装了这个库了。
 make 
 make install

放弃mysql官网的方法,用下面的方法:
命令:cmake . -DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql
提示信息:
-- Running cmake version 2.8.12.1
CMake Warning (dev) at CMakeLists.txt:191 (INCLUDE):
  Syntax Warning in cmake code at


    /home/cg/Downloads/mysql/mysql-5.6.15/cmake/ssl.cmake:237:55


  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.


-- MySQL 5.6.15
-- Packaging as: mysql-5.6.15-Linux-i686
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Could NOT find Curses (missing:  CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:85 (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:128 (FIND_CURSES)
  cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:401 (MYSQL_CHECK_EDITLINE)




-- Configuring incomplete, errors occurred!
See also "/home/cg/Downloads/mysql/mysql-5.6.15/CMakeFiles/CMakeOutput.log".
See also "/home/cg/Downloads/mysql/mysql-5.6.15/CMakeFiles/CMakeError.log".

命令:find /usr -name libncurses*
输出信息:
/usr/lib/libncurses.so.5
/usr/lib/libncursesw.so
/usr/lib/libncursesw.so.5.9
/usr/lib/libncurses.so.5.9
/usr/lib/libncurses.so
/usr/lib/libncursesw.so.5
命令:
cmake . -DCURSES_LIBRARY=/usr/lib/libncurses.so -DCURSES_INCLUDE_PATH=/usr/include
输出信息:
-- Running cmake version 2.8.12.1
CMake Warning (dev) at CMakeLists.txt:191 (INCLUDE):
  Syntax Warning in cmake code at


    /home/cg/Downloads/mysql/mysql-5.6.15/cmake/ssl.cmake:237:55


  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.


-- MySQL 5.6.15
-- Packaging as: mysql-5.6.15-Linux-i686
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Found Curses: /usr/lib/libncurses.so  
-- Looking for tputs in /usr/lib/libncurses.so
-- Looking for tputs in /usr/lib/libncurses.so - found
-- Performing Test HAVE_DECL_TGOTO
-- Performing Test HAVE_DECL_TGOTO - Failed
-- Performing Test HAVE_DECL_TGOTO2
-- Performing Test HAVE_DECL_TGOTO2 - Failed
-- Looking for strvis
-- Looking for strvis - not found
-- Looking for strunvis
-- Looking for strunvis - not found
-- Looking for include file libaio.h
-- Looking for include file libaio.h - not found
-- Looking for io_queue_init in aio
-- Looking for io_queue_init in aio - not found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - found
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64 - Success
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success
-- Looking for asprintf
-- Looking for asprintf - found
-- Check size of pthread_t
-- Check size of pthread_t - done
-- Using cmake version 2.8.12.1
-- 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
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- Configuring done
CMake Warning (dev) in sql/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.


  Target "mysqld" has an INTERFACE_LINK_LIBRARIES property which differs from
  its LINK_INTERFACE_LIBRARIES properties.


  INTERFACE_LINK_LIBRARIES:


    -lpthread;sql;binlog;rpl;master;slave;sql;mysys;mysys_ssl


  LINK_INTERFACE_LIBRARIES:


    rt


This warning is for project developers.  Use -Wno-dev to suppress it.


-- Generating done
-- Build files have been written to: /home/cg/Downloads/mysql/mysql-5.6.15

没有大问题,基本成功。
命令:
cmake . -DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql
在这条命令中,我没有设置mysql的配置参数,这对安装后的mysql的功能会有什么限制?能否有补救措施?
示例配置参数如下:
-DMYSQL_UNIX_ADDR=/etc/mysql/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/var/mysql/data \-DMYSQL_USER=mysql
不知道这些配置参数是否正确。
输出:
-- Running cmake version 2.8.12.1
CMake Warning (dev) at CMakeLists.txt:191 (INCLUDE):
  Syntax Warning in cmake code at


    /home/cg/Downloads/mysql/mysql-5.6.15/cmake/ssl.cmake:237:55


  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.


-- MySQL 5.6.15
-- Packaging as: mysql-5.6.15-Linux-i686
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Using cmake version 2.8.12.1
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- Configuring done
CMake Warning (dev) in sql/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.


  Target "mysqld" has an INTERFACE_LINK_LIBRARIES property which differs from
  its LINK_INTERFACE_LIBRARIES properties.


  INTERFACE_LINK_LIBRARIES:


    -lpthread;sql;binlog;rpl;master;slave;sql;mysys;mysys_ssl


  LINK_INTERFACE_LIBRARIES:


    rt


This warning is for project developers.  Use -Wno-dev to suppress it.


-- Generating done
-- Build files have been written to: /home/cg/Downloads/mysql/mysql-5.6.15

基本成功。
命令:
make install(15点13--15点58分)
命令:cp support-files/my-medium.cnf  /etc/my.cnf
在源码安装包没有my-medium.cnf文件。
另外,终端命令无法进入mysql的安装目录。不知道是怎么回事。
将上述命令修改为:
(copy--start)       support-files# cp my-default.cnf /etc
将etc内的my-default.cnf 改为my.cnf
在support-files目录执行命令cp mysql.server  /etc/init.d/mysqld
(copy--end)  
su - mysql
进入mysql的安装目录的scripts目录,执行命令:
 ./mysql_install_db --basedir=/home/cg/Apps/LAMP/mysql --datadir=/home/cg/Apps/LAMP/mysql /data/ --user=mysql
输出信息:
FATAL ERROR: Could not find ./bin/my_print_defaults


If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.


If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
命令:
 ./mysql_install_db --basedir=/home/cg/Apps/LAMP/mysql --datadir=/home/cg/Apps/LAMP/mysql /data/test --user=mysql
(一个很奇怪的问题:直接用命令cd mysql时,输出信息说不存在mysql目录。但是,当我复制ls命令列出来的mysql到cd命令中时,又可已进入mysql。我实在看不出我输入的mysql和复制来的mysql有什么不同)
这一次,我复制ls命令列出来的mysql到上面的命令中,出现了和之前不一样的提示信息:
Installing MySQL system tables...2013-12-15 17:08:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-12-15 17:08:13 16519 [ERROR] Fatal error: Can't change to run as user 'mysql' ;  Please check that the user exists!


2013-12-15 17:08:13 16519 [ERROR] Aborting


2013-12-15 17:08:13 16519 [Note] Binlog end
2013-12-15 17:08:13 16519 [Note] /home/cg/Apps/LAMP/mysql/bin/mysqld: Shutdown complete

执行命令:
 ./mysql_install_db --basedir=/home/cg/Apps/LAMP/mysql --datadir=/home/cg/Apps/LAMP/mysql /data/test
输出信息:
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:


  /home/cg/Apps/LAMP/mysql/bin/mysqladmin -u root password 'new-password'
  /home/cg/Apps/LAMP/mysql/bin/mysqladmin -u root -h startos password 'new-password'


Alternatively you can run:


  /home/cg/Apps/LAMP/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 . ; /home/cg/Apps/LAMP/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 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 /home/cg/Apps/LAMP/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 /home/cg/Apps/LAMP/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
mysql安装成功了。
中间步骤(copy-start)--(copy-end)可能无效
重新将mysql安装目录中support-files目录中的mysql.server复制到了/etc/init.d/mysql.server中,
执行命令:./mysql.server start
输出信息:
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/startos.pid).
由于无法启动mysql,而且cd 命令也无法进入mysql,我认为此次从源码编译安装mysql失败了。
先安装binary版本的mysql吧。
三、安装binary版本的mysql
root@startos:/home/cg/Downloads/mysql# cp mysql-5.6.15-linux-glibc2.5-i686.tar.gz /home/cg/Apps/LAMP

root@startos:/home/cg/Apps/LAMP# mv mysql-5.6.15-linux-glibc2.5-i686.tar.gz mysql.tar.gz
root@startos:/home/cg/Apps/LAMP# tar -xzvf mysql.tar.gz
root@startos:/home/cg/Apps/LAMP# mv mysql-5.6.15-linux-glibc2.5-i686 mysql​
​root@startos:/home/cg/Apps/LAMP/mysql/scripts#  ./mysql_install_db --basedir=/home/cg/Apps/LAMP/mysql --datadir=/home/cg/Apps/LAMP/mysql/data
输出信息:
Installing MySQL system tables.../home/cg/Apps/LAMP/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
上述问题解决不了,重新从源码编译安装把。
四、源码编译安装mysql
export PATH=/usr/lib/cmake/cmake/bin:$PATH

cmake . -DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql -DMYSQL_UNIX_ADDR=/etc/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql
报错信息:
- Could NOT find Curses (missing:  CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:85 (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:128 (FIND_CURSES)
  cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:401 (MYSQL_CHECK_EDITLINE)




-- Configuring incomplete, errors occurred!


命令:
cmake . -DCURSES_LIBRARY=/usr/lib/libncurses.so -DCURSES_INCLUDE_PATH=/usr/include

​cmake . -DCMAKE_INSTALL_PREFIX=/home/cg/Apps/LAMP/mysql -DMYSQL_UNIX_ADDR=/etc/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql
make install
 scripts/mysql_install_db --basedir=/home/cg/Apps/LAMP/mysql --datadir=/home/cg/Apps/LAMP/mysql /data/ --user=mysql
输出信息:
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:


  /home/cg/Apps/LAMP/mysql/bin/mysqladmin -u root password 'new-password'
  /home/cg/Apps/LAMP/mysql/bin/mysqladmin -u root -h startos password 'new-password'


Alternatively you can run:


  /home/cg/Apps/LAMP/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 . ; /home/cg/Apps/LAMP/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 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 /home/cg/Apps/LAMP/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

执行命令:
support-files# ./mysql.server start
Starting MySQL.. SUCCESS! 
终于安装成功了!
上一次没有安装成功,一定是因为安装目录mysql有问题。
另外,安装binary版本的mysql,我还没有掌握。
0 0
原创粉丝点击