Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选

首页 / 数据库 / MySQL / 源码编译安装 MySQL 5.5.30

源码编译安装 MySQL 5.5.300、安装cmake
[root@ www.linuxidc.com ~]# tar -zxvf cmake-2.8.11.2.tar.gz
[root@ www.linuxidc.com cmake-2.8.11.2]# ./configure
[root@ www.linuxidc.com cmake-2.8.11.2]# make
[root@ www.linuxidc.com cmake-2.8.11.2]# make install
1、添加mysql用户和组
[root@ www.linuxidc.com ~]#groupadd mysql
[root@ www.linuxidc.com ~]#useradd -g mysql mysql
 
2、编译MySQL程序[root@ www.linuxidc.com tar_mysql]# tar -zxvf mysql-5.5.30.tar.gz
[root@ www.linuxidc.com ~]# 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@ www.linuxidc.com mysql-5.5.30]#  make && make install3、拷贝数据库的配置文件并做修改 [root@ www.linuxidc.com ~]# cp -ar /usr/local/mysql5.5/support-files/my-medium.cnf  /usr/local/mysql5.5/etc/lyq314.cnf4、初始化数据库 /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=mysql5、添加环境变量
[root@ www.linuxidc.com ~]# echo "export PATH=$PATH:/usr/local/mysql5.5/bin" >> /etc/profile
[root@ www.linuxidc.com ~]# 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/mysqld8、设置管理员密码
/usr/local/mysql5.5/bin/mysqladmin -u root password "1q2w3e4r"
#/usr/local/mysql5.5/bin/mysqladmin -u root -p1q2w3e4r  password "123456"
9、登陆数据库进行测试
[root@ www.linuxidc.com 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@ www.linuxidc.com 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 包】 安装步骤及优缺点比较 http://www.linuxidc.com/Linux/2013-05/84003.htmOracle 10g 10.2.0.1 32位迁移升级到10g 10.2.0.5 64位Linux下将MySQL服务添加到服务器的系统服务中相关资讯      MySQL 5.5.30  MySQL源码编译安装 
  • Linux源码编译安装MySQL5.7.9  (04月11日)
  • CentOS 6.6 下源码编译安装MySQL 5  (08/14/2015 11:22:23)
  • MySQL 5.7.9源码编译安装说明  (10/30/2015 07:16:21)
  • MySQL 5.5.30 发布  (02/01/2013 12:46:24)
本文评论 查看全部评论 (0)
表情: 姓名: 字数