Ubuntu 10.10里下载MySQL源码及编译安装
Ubuntu 10.10里下载MySQL源码及编译安装
第一次在Linux(Ubuntu 10.10)上安装MySQL,还是费了一些周折,总算基本理清思路了。先说说我最终成功安装的步骤,即在Ubuntu 10.10里下载mysql源码,编译安装。
当前mysql版本是5.5.20,我的系统版本是ubuntu 10.10
1下载源码:
在官方网站,
选择:MySQL Community Server--download
选择 sourcecode,前面几个都是什么rpm,最后一个是我觉得应该下载的包
Generic Linux (Architecture Independent), Compressed TAR Archive | 5.5.20 | 23.2M | Download | |
(mysql-5.5.20.tar.gz) |
2下载完成,解压缩。
里面有个安装说明文件:INSTALL-SOURCE
打开,里面这一段是核心安装步骤:(命令前都加sudo执行!)
# Preconfiguration setup 首先是添加一个用户组
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz 解压缩源码包
shell> cd mysql-VERSION 切换到源码包目录
shell> cmake . 执行cmake,产生mk文件(没有cmake,sudo apt-get install cmake)
shell> make 编辑
shell> make install 安装
# End of source-build specific instructions -----------ok,安装完成了哦
# Postinstallation setup ----下面是配置mysql
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql ---执行内部mysql安装(参看红线下方执行结果)
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional --字面意思:下面这个命令可选
shell> cp support-files/my-medium.cnf /etc/my.cnf 复制mysql配置文件
shell> bin/mysqld_safe --user=mysql & 启动数据库
# Next command is optional --字面意思:下面这个命令可选
shell> cp support-files/mysql.server /etc/init.d/mysql.server 设置自启动
按照这个就能完整安装了
3安装完并且配置完,进去看一下
在/usr/local/mysql 目录,执行
root@ www.bkjia.com -laptop:/usr/local/mysql# ./bin/mysql -u root -S /tmp/mysql.sock -p
正常登录,提示:
- Server version: 5.5.20-log 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>
4官方网站有个gui工具,可以下载试一下:
MySQL Workbench (GUI Tool)
|
评论暂时关闭