Home  >  Article  >  Database  >  源码编译安装 MySQL 5.5.30

源码编译安装 MySQL 5.5.30

WBOY
WBOYOriginal
2016-06-07 17:30:53934browse

源码编译安装 MySQL 5.5.30 0、安装cmake[root@ www.linuxidc.com ~]# tar -zxvf cmake-2.8.11.2.tar.gz [root@ www.linuxidc.co

Linux公社

首页 → 数据库技术

背景:

阅读新闻

源码编译安装 MySQL 5.5.30

[日期:2013-07-27] 来源:Linux社区  作者:lyq314 [字体:]

源码编译安装 MySQL 5.5.30

0、安装cmake
[root@ ~]# tar -zxvf cmake-2.8.11.2.tar.gz
[root@ cmake-2.8.11.2]# ./configure
[root@ cmake-2.8.11.2]# make
[root@ cmake-2.8.11.2]# make install


1、添加mysql用户和组
[root@ ~]#groupadd mysql
[root@ ~]#useradd -g mysql mysql
 
2、编译MySQL程序

[root@ tar_mysql]# tar -zxvf mysql-5.5.30.tar.gz
[root@ ~]# cd mysql-5.5.30/
 /usr/local/bin/cmake \
 -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5 \
 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
 -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 \
 -DWITH_MYISAM_STORAGE_ENGINE=1 \
 -DWITH_INNOBASE_STORAGE_ENGINE=1  \
 -DWITH_READLINE=1 \
 -DENABLED_LOCAL_INFILE=1 \
 -DMYSQL_DATADIR=/home/mysql/data \
 -DWITH_DEBUG=0
[root@ mysql-5.5.30]#  make && make install

3、拷贝数据库的配置文件并做修改

 [root@ ~]# cp -ar /usr/local/mysql5.5/support-files/my-medium.cnf  /usr/local/mysql5.5/etc/lyq314.cnf

4、初始化数据库

 /usr/local/mysql5.5/scripts/mysql_install_db  --defaults-file=/usr/local/mysql5.5/etc/lyq314.cnf --basedir=/usr/local/mysql5.5/ --datadir=/home/mysql/data --user=mysql

5、添加环境变量
[root@ ~]# echo "export PATH=$PATH:/usr/local/mysql5.5/bin" >> /etc/profile
[root@ ~]# source /etc/profile
6、mysql的启动
 /usr/local/mysql5.5/bin/mysqld_safe --defaults-file=/usr/local/mysql5.5/etc/lyq314.cnf --datadir=/home/mysql/data --user=mysql &
7、查看mysql服务端口
# netstat -tunlp
[root@localhost etc]# netstat -nltp |grep 3306
tcp    00    0.0.0.0:3306    0.0.0.0:*    LISTEN24752/mysqld

8、设置管理员密码
/usr/local/mysql5.5/bin/mysqladmin -u root password '1q2w3e4r'
#/usr/local/mysql5.5/bin/mysqladmin -u root -p1q2w3e4r  password '123456'
9、登陆数据库进行测试
[root@ mysql-5.5.30]# /usr/local/mysql5.5/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.5.30-log Source distribution
Copyright (c) 2000, 2013, 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> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test              |
+--------------------+
4 rows in set (0.02 sec)
mysql>

10、MySQL 的关闭
[root@ mysql-5.5.30]# /usr/local/mysql5.5/bin/mysqladmin  -uroot -p shutdown
Enter password:
130717 00:31:09 mysqld_safe mysqld from pid file /home/mysql/data/lyq314.pid ended

相关阅读:

MySQL 5.5 三大安装方式:【二进制、源代码编译 和 RPM 包】 安装步骤及优缺点比较

linux

  • 0
  • Oracle 10g 10.2.0.1 32位迁移升级到10g 10.2.0.5 64位

    Linux下将MySQL服务添加到服务器的系统服务中

    相关资讯       MySQL 5.5.30  MySQL源码编译安装 

  • MySQL 5.5.30 发布  (02/01/2013 12:46:24)
  • 图片资讯      

    本文评论   查看全部评论 (0)

    评论声明

    最新资讯

    本周热门

    Linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
    本站(LinuxIDC)所刊载文章不代表同意其说法或描述,仅为提供更多信息,,也不构成任何建议。


    Copyright © 2006-2011 Linux公社 All rights reserved 浙ICP备06018118号

    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn