Linux学习笔记:LAMP 2 安装Mysql

举报
wh_bn 发表于 2021/12/15 23:14:26 2021/12/15
【摘要】 参考这篇文章 本机环境:ubuntu12.04,fedora-17 MYSQL版本:5.5.28 CMAKE版本:2.8.9 一.下载最新版本的cmake,解压后编译安装. sudo ./configure --prefix=/usr/local/etc/cmake-2.8.9 sudo make s...

参考这篇文章

本机环境:ubuntu12.04,fedora-17

MYSQL版本:5.5.28

CMAKE版本:2.8.9

一.下载最新版本的cmake,解压后编译安装.

sudo ./configure --prefix=/usr/local/etc/cmake-2.8.9
sudo make
sudo make install
sudo ln -s /usr/local/etc/cmake-2.8.9/bin/cmake /usr/local/bin/cmake

 现在可以使用cmake命令了!

如果出现以下提示,请先安装g++。

复制代码
---------------------------------------------
CMake 2.8.9, Copyright 2000-2011 Kitware, Inc.
C compiler on this system is: cc 
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.9/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
复制代码

ubuntu下用

sudo apt-get install g++

redhat系列下用

sudo yum install gcc-c++

 

下载最新的mysql源码包,解压后,进入其跟目录

复制代码
sudo cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/etc/mysql-5.5.28 \  
-DMYSQL_DATADIR=/usr/local/etc/mysql-5.5.28/data \   
-DEXTRA_CHARSETS=all \  
-DDEFAULT_CHARSET=utf8 \  
-DDEFAULT_COLLATION=utf8_general_ci \ 
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \  
-DWITH_INNOBASE_STORAGE_ENGINE=1 \

# 这里附上一行版的,方便粘贴
# 注:此处路径为/opt下,如果要和上面保持一致,请手动修改
# sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.28 -DMYSQL_DATADIR=/opt/mysql-5.5.28/data -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1

sudo make
sudo make install
复制代码

如果编译过程出现如下错误 需安装libncurses5-dev

复制代码
-- 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:127 (FIND_CURSES)
  cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:268 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!
复制代码
sudo apt-get install libncurses5-dev
#删除编译缓存信息
sudo rm -rf CMakeCache.txt

 

编译完成后进入源码解压目录

sudo cp support-files/my-medium.cnf /etc/my.cnf

然后初始化数据库,不过在此之前,我们要先创建一个mysql用户

sudo useradd mysql
sudo ./scripts/mysql_install_db --user=mysql --data=/usr/local/etc/mysql-5.5.28/data sudo .
/support-files/mysql.server start sudo ./bin/mysql -u root -p

本机环境:ubuntu12.04,fedora-17

MYSQL版本:5.5.28

CMAKE版本:2.8.9

一.下载最新版本的cmake,解压后编译安装.

sudo ./configure --prefix=/usr/local/etc/cmake-2.8.9
sudo make
sudo make install
sudo ln -s /usr/local/etc/cmake-2.8.9/bin/cmake /usr/local/bin/cmake

 现在可以使用cmake命令了!

如果出现以下提示,请先安装g++。

复制代码
---------------------------------------------
CMake 2.8.9, Copyright 2000-2011 Kitware, Inc.
C compiler on this system is: cc 
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.9/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
复制代码

ubuntu下用

sudo apt-get install g++

redhat系列下用

sudo yum install gcc-c++

 

下载最新的mysql源码包,解压后,进入其跟目录

复制代码
sudo cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/etc/mysql-5.5.28 \  
-DMYSQL_DATADIR=/usr/local/etc/mysql-5.5.28/data \   
-DEXTRA_CHARSETS=all \  
-DDEFAULT_CHARSET=utf8 \  
-DDEFAULT_COLLATION=utf8_general_ci \ 
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \  
-DWITH_INNOBASE_STORAGE_ENGINE=1 \

# 这里附上一行版的,方便粘贴
# 注:此处路径为/opt下,如果要和上面保持一致,请手动修改
# sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.28 -DMYSQL_DATADIR=/opt/mysql-5.5.28/data -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1

sudo make
sudo make install
复制代码

如果编译过程出现如下错误 需安装libncurses5-dev

复制代码
-- 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:127 (FIND_CURSES)
  cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:268 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!
复制代码
sudo apt-get install libncurses5-dev
#删除编译缓存信息
sudo rm -rf CMakeCache.txt

 

编译完成后进入源码解压目录

sudo cp support-files/my-medium.cnf /etc/my.cnf

然后初始化数据库,不过在此之前,我们要先创建一个mysql用户

sudo useradd mysql
sudo ./scripts/mysql_install_db --user=mysql --data=/usr/local/etc/mysql-5.5.28/data sudo .
/support-files/mysql.server start sudo ./bin/mysql -u root -p

文章来源: blog.csdn.net,作者:fengda2870,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/fengda2870/article/details/8816602

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。