mysql-5.5 for linux源代码安装

1.使用Yum安装依赖软件包

# yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison zlib* fiex* \

libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

 

2.安装cmake

# yum install -y cmake

 

3.解压缩并编译安装MySQL源代码包

 

# tar xzvf mysql-5.5.27.tar.gz

# mv mysql-5.5.27 mysql

# cd mysql

 

#配置编译(參考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html)

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DSYSCONFDIR=/usrl/local/mysql/etc \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DMYSQL_TCP_PORT=3306 \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DMYSQL_USER=mysql \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS=all \

-DWITH_READLINE=1 \

-DWITH_SSL=system \

-DWITH_EMBEDDED_SERVER=1 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1

 

# make 

# make install

 

注意事项:

又一次编译时,须要清除旧的对象文件和缓存信息。

# make clean

# rm -f CMakeCache.txt

 

4.加入mysql用户及用户组并改动文件夹全部权限

[root@ttt mysql]# groupadd mysql

[root@ttt mysql]# useradd -r -g mysql mysql

[root@ttt mysql]# chown -R mysql /usr/local/mysql

[root@ttt mysql]# chgrp -R mysql /usr/local/mysql

 

 

5.安装基础数据库并复制演示样例配置文件

# cd /usr/local/mysql

# chmod +x scripts/*

[root@ttt mysql]#  ./scripts/mysql_install_db --basedir=/usr/local/mysql \

--datadir=/usr/local/mysql/data --user=mysql

 

# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

 

[root@ttt ~]# export PATH=$PATH:/usr/local/mysql/bin    //全局宣告mysql命令的路径

[root@ttt ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile   //写入开机启动文件

 

6.注冊mysql系统服务并启动mysql

 

[root@ttt mysql]# chmod 755 support-files/mysql.server

[root@ttt mysql]# ls -l support-files/mysql.server

-rwxr-xr-x 1 mysql mysql 10650 6月  22 19:21 support-files/mysql.server

[root@ttt mysql]# cp support-files/mysql.server /etc/init.d/mysql

[root@ttt mysql]# chown root.root /etc/init.d/mysql

[root@ttt mysql]# chkconfig --add mysql

[root@ttt mysql]# chkconfig --level 35 mysql on

[root@ttt mysql]# chkconfig --list mysql

mysql           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@ttt mysql]# service mysql start

Starting MySQL...                                          [确定]

[root@ttt mysql]# netstat -ltu |grep mysql

tcp        0      0 *:mysql               *:*                   LISTEN

[root@ttt mysql]# ps -ef | grep mysql

root     15492     1  0 21:00 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe 

--datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ttt.pid

mysql    15744 15492  0 21:00 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --

basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-

dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/ttt.err 

--pid-file=/usr/local/mysql/data/ttt.pid --socket=/tmp/mysql.sock --port=3306

root     15896  1098  0 21:10 pts/0    00:00:00 grep mysql

 

7.安装完毕。启动mysql数据库。进入測试

 

[root@ttt ~]# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.27-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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> use mysql

Database changed

mysql> show tables;

+---------------------------+

| Tables_in_mysql           |

+---------------------------+

| columns_priv              |

| db                        |

| event                     |

| func                      |

| general_log               |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| host                      |

| ndb_binlog_index          |

| plugin                    |

| proc                      |

| procs_priv                |

| proxies_priv              |

| servers                   |

| slow_log                  |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

+---------------------------+

24 rows in set (0.00 sec)

 

mysql>

 

8.改动mysql数据库root用户密码并登录验证

 

[root@ttt ~]# mysqladmin -u root password 'mysqlpass'  --给“root”用户设置一个密码

[root@ttt ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.5.27-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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> 

 

 

 

 

mysql-5.5 for linux源代码安装的更多相关文章

  1. linux 源代码安装mysql5.5

    linux下源代码安装mysql过程例如以下: yum update yum upgrade yum install -y vim man wget yum install -y gcc gcc-c+ ...

  2. linux源代码安装程序

    下载源代码之后 tar zxvf file.tar.gz      解压源代码压缩包 ./configure --prefix=/opt/haha/  安装到这个路径 make  编译 sudo ma ...

  3. Linux 通过源代码安装和编译程序

    Linux源代码安装在平常工作学习中经常用到,总结下步骤↓↓↓ 第一步:#mount /dev/cdrom/mnt (挂载一个软盘) 第二步:手动安装httpd-2.4.25.tar.gz 依赖关系包 ...

  4. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  5. SUSE Linux源代码编译安装MySQL 5.6

    这篇文章主要介绍了SUSE Linux下源代码编译方式安装MySQL 5.6过程分享,本文使用SUSE Linux Enterprise Server 10 SP3 (x86_64)系统,须要的朋友能 ...

  6. 源代码安装 MySQL 5.6.28

    本文内容 创建 MySQL 用户和组 解压 MySQL 源代码包 生成配置安装文件 编译和安装 MySQL 配置文件 创建 MySQL 授权表 MySQL 目录授权 启动 MySQL 验证 MySQL ...

  7. linux下安装Mysql 以及导入数据库

    1.下载mysql的rpm包,创建一个文件夹例如software来放置下面文件 可以通过wget下载具体的地址 (1)MySQL-server-5.6.10-1.rhel5.x86_64.rpm:My ...

  8. 源代码安装软件-MySQL

    一.源码安装 1.经典的源代码安装三步曲: 1.编译前的配置 ./configure 2.编译 make 3.安装 make install 2.源代码软件安装步骤: 1.下载软件包 2.校验软件包 ...

  9. mysql数据库在Linux下安装与配置

      mysql是一种开放源代码的关系型数据库系统(RDBMS),使用最常用的数据库管理语言--结构化查询语句(SQL)进行数据库管理. 由于mysql的开源,因此任何人都可以在General Publ ...

随机推荐

  1. WINFORM如何实现无聚焦框的Button按钮

    当我们将一个button按钮设置如下属性时,总有一个聚焦框来困扰着我们 button1.FlatStyle = FlatStyle.Flat; 我们想要的效果是这样的: 但当使用了Tab切换焦点时 发 ...

  2. WPF: RenderTransform特效

    WPF中的变形(RenderTransform)类是为了达到直接去改变某个Silverlight对象的形状(比如缩放.旋转一个元素)的目的而设计的,RenderTransform包含的变形属性成员就是 ...

  3. git pull和git pull --rebase的使用

    使用下面的关系区别这两个操作: git pull = git fetch + git merge git pull --rebase = git fetch + git rebase 现在来看看git ...

  4. ASP.NET MVC与ASP.NET WebForm

    ASP.NET MVC是微软公司的一款WEB开发框架,整合了“模型-视图-控制器”架构的高效与整洁,是敏捷开发最现代的思想与技术.它是传统ASP.NET WebForm的一个完善的替代品. 1.当今的 ...

  5. Oracle数据库基本操作 (五) —— 使用java调用存储过程

    一.环境准备 登录Oracle数据库scott账号,利用emp进行操作. 1.创建 proc_getyearsal 存储过程 -- 获取指定员工年薪 create or replace procedu ...

  6. Document对象关于窗口的一些属性

    在网上搜罗的,只为自己查用方便,不做他用 window.screen.availWidth 返回当前屏幕宽度(空白空间) window.screen.availHeight 返回当前屏幕高度(空白空间 ...

  7. js组件开发-移动端地区选择控件mobile-select-area

    移动端地区选择控件mobile-select-area 由于之前的[js开源组件开发]js手机联动选择地区仿ios 开源git 很受欢迎,于是我又对其进行了一些优化,包括可选的范围变大了,添加了默认空 ...

  8. SQL-OVER与四种排名函数:ROW_NUMBER(),RANK(),DENSE_RANK(),NTILE()

    1 SELECT orderid,custid,val, ROW_NUMBER() OVER(ORDER BY val) AS rownum, RANK() OVER(ORDER BY val) AS ...

  9. Linux命令行bash批量重命名文件

    本文介绍下,在linux下使用shell批量重命名文件的例子,有需要的朋友参考下吧. 在linux中,重命名文件名,需要用到mv命令.如果需要批量重命名名一批文件,就需要写bash脚本或命令行了. 例 ...

  10. Java 之集合框架 上(9)

    Java 中的集合框架 如果一个类中存在很多相同类型的属性. 例如:学生类 学生可以选课,因此存在很多课程类型的属性.但是每个学生选择的课程的种类和数量是不一样的. 如果将每一个课程类型的属性都列到课 ...