首页 > 数据库 >rhel 6.5以编译方式安装mysql 5.5.18

rhel 6.5以编译方式安装mysql 5.5.18

时间:2023-08-19 13:01:12浏览次数:46  
标签:5.5 -- 18 devel 6.5 Master mysql root MySQL5518

文档课题:rhel 6.5以编译方式安装mysql 5.5.18
数据库:mysql 5.5.18
系统:rhel 6.5 64位
安装包:mysql-5.5.18.tar.gz
1、卸载MariaDB
--卸载系统自带的mysql和mariadb-lib.
[root@MySQL5518-Master ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@MySQL5518-Master ~]# rpm -qa | grep mariadb
[root@MySQL5518-Master ~]# /bin/rpm -e $(/bin/rpm -qa | grep mysql|xargs) --nodeps

2、安装依赖包
[root@MySQL5518-Master ~]# mount /dev/sr0 /mnt
[root@MySQL5518-Master ~]# mkdir -p /etc/yum.repos.d/bak
[root@MySQL5518-Master ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
[root@MySQL5518-Master ~]# cat <<EOF>>/etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1
EOF
[root@MySQL5518-Master ~]# yum makecache
[root@MySQL5518-Master ~]# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel \
freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \
curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel \
libidn libidn-devel openssl openssl-devel \
openldap openldap-devel nss_ldap \
openldap-clients openldap-servers
--检查依赖包的安装情况
[root@MySQL5518-Master ~]# rpm -q gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel \
freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \
curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel \
libidn libidn-devel openssl openssl-devel \
openldap openldap-devel nss_ldap \
openldap-clients openldap-servers | grep "not installed"

以下包未安装成功:
package libjpeg is not installed
package libjpeg-devel is not installed
package curl-devel is not installed
package krb5 is not installed
package nss_ldap is not installed

3、安装cmake
--上传cmake
sftp> lcd F:\package
sftp> put cmake-2.8.4.tar.gz

--安装cmake
[root@MySQL5518-Master ~]# tar -zxf cmake-2.8.4.tar.gz
[root@MySQL5518-Master cmake-2.8.4]# pwd
/root/cmake-2.8.4
[root@MySQL5518-Master cmake-2.8.4]# ./configure
[root@MySQL5518-Master cmake-2.8.4]# make
[root@MySQL5518-Master cmake-2.8.4]# make install

4、建用户及组
[root@MySQL5518-Master ~]# groupadd mysql
[root@MySQL5518-Master ~]# useradd -g mysql mysql

5、安装包处理
5.1、上传安装包
sftp> lcd F:\installmedium\mysql\MySQL-5.5.18
sftp> put mysql-5.5.18.tar.gz

5.2、解压安装包
[root@MySQL5518-Master ~]# tar -zxf mysql-5.5.18.tar.gz
[root@MySQL5518-Master ~]# cd mysql-5.5.18

5.3、开始编译
[root@MySQL5518-Master ~]# /usr/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql \
-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_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data \
-DMYSQL_USER=mysql -DWITH_DEBUG=0

[root@MySQL5518-Master mysql-5.5.18]# make && make install
[root@MySQL5518-Master mysql-5.5.18]# chmod +w /usr/local/webserver/mysql
[root@MySQL5518-Master mysql-5.5.18]# chown -R mysql:mysql /usr/local/webserver/mysql
[root@MySQL5518-Master mysql-5.5.18]# cp support-files/my-small.cnf /etc/my.cnf
[root@MySQL5518-Master mysql-5.5.18]# chown mysql:mysql /etc/my.cnf
[root@MySQL5518-Master mysql-5.5.18]# cp /root/mysql-5.5.18/support-files/mysql.server /etc/rc.d/init.d/mysqld

6、开始安装
[root@MySQL5518-Master mysql-5.5.18]# /usr/local/webserver/mysql/scripts/mysql_install_db \
--user=mysql \
--basedir=/usr/local/webserver/mysql \
--datadir=/var/mysql/data

7、安装后配置
7.1、修改文件
[root@MySQL5518-Master ~]# vi /etc/init.d/mysqld
#按以下变量内容修改 
basedir=/usr/local/webserver/mysql 
datadir=/var/mysql/data

[root@MySQL5518-Master ~]# chmod +x /etc/init.d/mysqld

[root@MySQL5518-Master ~]# vi /etc/my.cnf
[mysqld]下添加如下,InnoDB配置以减少内存.
default-storage-engine=MyISAM
server-id       = 1
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

basedir=/usr/local/webserver/mysql 
datadir=/var/mysql/data

[root@MySQL5518-Master ~]# mkdir -p /usr/local/mysql
[root@MySQL5518-Master ~]# cd /usr/local
[root@MySQL5518-Master local]# chown -R mysql:mysql mysql

7.2、设置开机自启
--增加mysqld服务
[root@MySQL5518-Master ~]# chkconfig --add mysqld
--设定mysqld在等级3、4、5为开启运行服务.
[root@MySQL5518-Master ~]# chkconfig --level 345 mysqld on
[root@MySQL5518-Master ~]# chkconfig --list | grep mysql
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@MySQL5518-Master local]# service mysqld start
Starting MySQL..                                           [  OK  ]

[root@MySQL5518-Master local]# ps -ef|grep mysql
root       4363      1  0 10:28 pts/1    00:00:00 /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --datadir=/var/mysql/data --pid-file=/var/mysql/data/MySQL5518-Master.pid
mysql      4782   4363  0 10:28 pts/1    00:00:00 /usr/local/webserver/mysql/bin/mysqld --basedir=/usr/local/webserver/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/webserver/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/MySQL5518-Master.err --pid-file=/var/mysql/data/MySQL5518-Master.pid --socket=/tmp/mysql.sock --port=3306
root       4807   2488  0 10:28 pts/1    00:00:00 grep mysql

8、修改密码
[root@MySQL5518-Master ~]# /usr/local/webserver/mysql/bin/mysqladmin -u root password mysql_4U
[mysql@MySQL5518-Master bin]$ pwd
/usr/local/webserver/mysql/bin
[mysql@MySQL5518-Master bin]$ ./mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.18 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)

9、重启验证
--重启系统后mysql数据库自动开启.
[root@MySQL5518-Master mysql]# reboot

Broadcast message from root@MySQL5518-Master
        (/dev/pts/1) at 11:57 ...

The system is going down for reboot NOW!
[root@MySQL5518-Master mysql]# 
Last login: Fri Aug 18 23:26:01 2023 from 192.168.133.1
[root@MySQL5518-Master ~]# ps -ef | grep mysql
root       1724      1  0 11:58 ?        00:00:00 /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --datadir=/var/mysql/data --pid-file=/var/mysql/data/MySQL5518-Master.pid
mysql      2143   1724  0 11:58 ?        00:00:00 /usr/local/webserver/mysql/bin/mysqld --basedir=/usr/local/webserver/mysql --datadir=/var/mysql/data --plugin-dir=/usr/local/webserver/mysql/lib/plugin --user=mysql --log-error=/var/mysql/data/MySQL5518-Master.err --pid-file=/var/mysql/data/MySQL5518-Master.pid --socket=/tmp/mysql.sock --port=3306
root       2471   2451  0 12:00 pts/0    00:00:00 grep mysql

参考网址:https://www.cnblogs.com/fangbo/archive/2011/04/01/2002637.html

标签:5.5,--,18,devel,6.5,Master,mysql,root,MySQL5518
From: https://blog.51cto.com/u_12991611/7148869

相关文章

  • 【LeetCode2118. 建立方程】 group_concat指定分隔符,指定排序顺序
    目录题目地址题目描述代码题目地址https://leetcode.cn/problems/build-the-equation/description/题目描述Example2:输入:Terms表:+-------+--------+|power|factor|+-------+--------+|4|-4||2|1||1|-1|+-------+---......
  • CF1842E
    原题翻译挺好的dp题,tsx推荐XD首先可以发现如果两个三角形有交肯定不优,于是我们考虑按照\(x\leqi\)的顺序dp设\(dp_i\)表示\(x\leqi\)的点全覆盖的最小贡献容易得到转移:\[dp_i=\min_{j=1}^{i-1}{(dp_j+j-i+\sum_{l=1}^{n}{(c_l*[j\leqx_l\leqi\&y_l\leqk-i])}......
  • CF-1860C Game on Permutation题解
    题意:在一条数轴上,Alice可以跳到在你所在点前面且值比当前所在点小的点。每回合可以向任意符合要求的点跳一次。当轮到Alice的回合同时不存在符合要求的点,Alice就赢了。Alice可以选择一个点作为起始点,然后作为后手(赛时这里把我坑了)。问有多少个点是必胜的点。\(n\leq3\times10^5......
  • CF1842D
    原题翻译题目背景生草因为我们想让聚会时间越长越好,所以我们对于从1开始的某一个限制,我们直到他到达了最大时间再把他加入,由此得到答案的上限为\(1\rightarrown\)的最短路,且这个上限是总是可以取到的因此如果这个上限\(>10^{18}\)就可以结束了否则我们考虑以下构建集合的......
  • CF1860E
    原题翻译首先考虑一个暴力的做法,暴力建图,对每一个询问跑BFS,总复杂度\(O(n^2q)\),不可过我们发现这个图的瓶颈在于对于光标的跳转(即第三种操作),我们可以建一个虚拟节点来解决这个问题,原图的点数变为\(O(n+D^2)\),边数\(O(n)\),其中\(D\)表示字母种类数这时我们把原题的复杂度优化......
  • CF1860D
    原题翻译补题的时候想了半天交换后对01和10个数的影响,写了半天的dp才发现前面的修改会影响0和1的个数(我是shabi)不过我感觉应该还是可做的直接说正解。首先显然我们不需要同时记录0的个数和1的个数,因为知道一个可以通过\(i-cnt\)得到另一个仔细一想,我们其实也不需要同时记录......
  • 8.18总结
    今天五点半起来,检查东西是否都带齐,今天奶奶也要做手术,希望能够快快好起来,中午一点多到学校,搬行李,累死个人,行李很重而且二教离九栋很远,累的我虚脱,晚上洗澡逃了培训会,然后和妈妈打电话询问奶奶情况,做了微创手术,过几天应该可以出院了,然后就找朋友玩了会,就睡觉了......
  • 8.18Day2
    0+60+60+95=215T1期望还是太差了,说是找规律,看了2个小时都没有找出规律,因为多测,40暴力分暴力还挂了按每个位置考虑,因为期望的线性性,考虑最终是不是在原位上即可,只有01所以是伯努利分布,E=np,递推或者找通项都okT2原题,吐槽一下大样例,完全没有强度,过了只有60分T3直接逆向还原(a,b)......
  • 2023/08/18
    数值被颠倒。例如:输入123456则运行后654321importjava.util.Scanner;publicclassTest{publicstaticvoidmain(String[]args){System.out.print("请输入一个正整数:");Scannersc=newScanner(System.in);inta=......
  • CF1806E 题解
    题目大意给你一棵树,然后定义一个函数$f(x,y)$,接下来给你$q$组询问\(x_{i},y_{i}\),让你求每一次的$f(x_{i},y_{i})$。分析首先我们尝试根据这个函数的定义暴力求值,代码实现如下。llBFquery(intg,inth){if(!g)return0;return1ll*a[g]*a[h]+BFquery(p......