在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Linux下如何安装配置源代码版本的MySQL

120次阅读
没有评论

共计 7343 个字符,预计需要花费 19 分钟才能阅读完成。

这篇文章主要为大家展示了“Linux 下如何安装配置源代码版本的 MySQL”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让丸趣 TV 小编带领大家一起研究并学习一下“Linux 下如何安装配置源代码版本的 MySQL”这篇文章吧。

操作系统版本:Red Hat Enterprise Linux Server release 5 (Tikanga)
MySQL 版本:
安装文件:MySQL-community-5.1.45-1.rhel5.src.rpm

 1. 释放源代码包

    使用的安装文件是一个 source RPM,首先要将其内容释放:

方法一:

[root@redhat5-db-1 software]# rpm -i MySQL-community-5.1.45-1.rhel5.src.rpm
error: cannot create %sourcedir /usr/src/redhat/SOURCES
[root@redhat5-db-1 software]# mkdir -p /usr/src/redhat/SOURCES
[root@redhat5-db-1 software]# rpm -i MySQL-community-5.1.45-1.rhel5.src.rpm
warning: user mysqldev does not exist – using root
warning: group mysqldev does not exist – using root
warning: user mysqldev does not exist – using root
warning: group mysqldev does not exist – using root
[root@redhat5-db-1 software]# ls /usr/src/redhat/*
/usr/src/redhat/SOURCES:
mysql-5.1.45.tar.gz

/usr/src/redhat/SPECS:
mysql-5.1.45.rhel5.spec

[@more@] 方法二:

[root@redhat5-db-1 software]# rpm2cpio MySQL-community-5.1.45-1.rhel5.src.rpm | cpio -idmv
mysql-5.1.45.rhel5.spec
mysql-5.1.45.tar.gz
43995 blocks
[root@redhat5-db-1 software]# ls
mysql-5.1.45.rhel5.spec  mysql-5.1.45.tar.gz  MySQL-community-5.1.45-1.rhel5.src.rpm

注:无论使用哪种方法,都会在释放源代码包的同时,释放另一个文件 mysql-5.1.45.rhel5.spec。它是一个 RPM SPEC 文件,可以通过 rpmbuild 命令创建 MySQL 的源代码文件或二进制程序(-bp 选项在 /usr/src/redhat/BUILD 目录下创建源代码文件,-bb 选项在 /usr/src/redhat/RPM 目录下创建二进制程序),这里不再赘述。

 2. 安装前的准备工作

 1) 创建用户和组

[root@redhat5-db-1 software]# groupadd mysql
[root@redhat5-db-1 software]# useradd -g mysql mysql
[root@redhat5-db-1 software]# id mysql
uid=502(mysql) gid=504(mysql) groups=504(mysql)

 2) 准备必要的目录

[root@redhat5-db-1 software]# mkdir -p /opt/mysql /data/mysql
[root@redhat5-db-1 software]# chown mysql:mysql /opt/mysql /data/mysql

 3) 安装必要的 RPM

    需要安装 ncurses-devel,否则编译时会报如下错误:

checking for termcap functions library… configure: error: No curses/termcap library found

    在 Red Hat EL 5 安装光盘中找到该 RPM,进行安装:

[root@redhat5-db-1 software]# mount -o ro /dev/cdrom /mnt/cdrom
[root@redhat5-db-1 software]# rpm -ivh /mnt/cdrom/Server/ncurses-devel-5.5-24.20060715.i386.rpm
warning: /mnt/cdrom/Server/ncurses-devel-5.5-24.20060715.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing…                ########################################### [100%]
  1:ncurses-devel          ########################################### [100%]

 4) 解压源代码包

[root@redhat5-db-1 software]# tar -zxf mysql-5.1.45.tar.gz
[root@redhat5-db-1 software]# ls -p
mysql-5.1.45/  mysql-5.1.45.rhel5.spec  mysql-5.1.45.tar.gz  MySQL-community-5.1.45-1.rhel5.src.rpm

 3. 安装 MySQL

 1)CONFIGURE

[root@redhat5-db-1 software]# su – mysql
[mysql@redhat5-db-1 ~]$ cd /opt/software/mysql-5.1.45
[mysql@redhat5-db-1 mysql-5.1.45]$ ./configure –prefix=/opt/mysql –localstatedir=/data/mysql –with-plugins=innobase
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c

……

config.status: executing depfiles commands
config.status: executing libtool commands
/bin/rm: cannot remove `libtoolT : No such file or directory
config.status: executing default commands

Thank you for choosing MySQL!

Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.

注:–prefix 选项指定 MySQL 程序的路径;–localstatedir 选项指定 MySQL 数据文件的路径;–with-plugins=innobase 指定 MySQL 服务器包含 InnoDB 功能。

 2)MAKE

[mysql@redhat5-db-1 mysql-5.1.45]$ make
Making all in .
make[1]: Entering directory `/opt/software/mysql-5.1.45
make abi_headers= include/mysql/plugin.h include/mysql.h do_abi_check
make[2]: Entering directory `/opt/software/mysql-5.1.45

……

Making all in win
make[1]: Entering directory `/opt/software/mysql-5.1.45/win
make[1]: Nothing to be done for `all .
make[1]: Leaving directory `/opt/software/mysql-5.1.45/win

 3)MAKE-INSTALL

[mysql@redhat5-db-1 mysql-5.1.45]$ make install
Making install in .
make[1]: Entering directory `/opt/software/mysql-5.1.45
make abi_headers= include/mysql/plugin.h include/mysql.h do_abi_check
make[2]: Entering directory `/opt/software/mysql-5.1.45

……

Making install in win
make[1]: Entering directory `/opt/software/mysql-5.1.45/win
make[2]: Entering directory `/opt/software/mysql-5.1.45/win
make[2]: Nothing to be done for `install-exec-am .
make[2]: Nothing to be done for `install-data-am .
make[2]: Leaving directory `/opt/software/mysql-5.1.45/win
make[1]: Leaving directory `/opt/software/mysql-5.1.45/win
[mysql@redhat5-db-1 mysql-5.1.45]$ ls /opt/mysql
bin  docs  include  lib  libexec  mysql-test  share  sql-bench

 4. 安装后的工作

 1) 创建选项文件

[root@redhat5-db-1 ~]# cp /opt/software/mysql-5.1.45/support-files/my-medium.cnf /etc/my.cnf
[root@redhat5-db-1 ~]# chown mysql:mysql /etc/my.cnf

    可以通过修改其内容对 MySQL 服务器进行配置。这里只简单取消 InnoDB 相关参数所在行的注释:

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /data/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /data/mysql/
# You can set .._buffer_pool_size up to 50 – 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

 2) 设置环境变量

    在 mysql 的 HOME 目录下的.bash_profile 文件中添加如下内容:

# Added by ggyy on March 31st, 2010
PATH=$PATH:/opt/mysql/bin
export PATH

 3) 初始化 MySQL

[mysql@redhat5-db-1 ~]$ /opt/mysql/bin/mysql_install_db
Installing MySQL system tables…
100331 18:21:59 [Warning] –skip-locking is deprecated and will be removed in a future release. Please use –skip-external-locking instead.
OK
Filling help tables…
100331 18:22:00 [Warning] –skip-locking is deprecated and will be removed in a future release. Please use –skip-external-locking instead.
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/opt/mysql/bin/mysqladmin -u root password new-password
/opt/mysql/bin/mysqladmin -u root -h redhat5-db-1 password new-password

Alternatively you can run:
/opt/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/mysql ; /opt/mysql/bin/mysqld_safe

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /opt/mysql/bin/mysqlbug script!

[mysql@redhat5-db-1 ~]$ ls /data/mysql
mysql  mysql-bin.000001  mysql-bin.000002  mysql-bin.index  test

 3) 启动和关闭 MySQL

    启动 MySQL 服务器,测试登陆:

[mysql@redhat5-db-1 ~]$ /opt/mysql/bin/mysqld_safe
[1] 3028
[mysql@redhat5-db-1 ~]$ 100331 18:27:18 mysqld_safe Logging to /data/mysql/redhat5-db-1.err .
100331 18:27:18 mysqld_safe Starting mysqld daemon with databases from /data/mysql

mysql select version();
+————+
| version()  |
+————+
| 5.1.45-log |
+————+
1 row in set (0.00 sec)

mysql show variables like have_innodb
+—————+——-+
| Variable_name | Value |
+—————+——-+
| have_innodb   | YES   |
+—————+——-+
1 row in set (0.00 sec)

    可以使用 mysql.server 脚本启动和关闭 MySQL 服务器,它位于解压的源代码目录下的 support-files 子目录中。该目录下还有许多其它有用的文件、脚本,可以考虑将其复制到 MySQL 程序目录下,并在.bash_profile 文件里的 PATH 中添加相应路径。

[mysql@redhat5-db-1 ~]$ cp -pr /opt/software/mysql-5.1.45/support-files /opt/mysql
[mysql@redhat5-db-1 ~]$ chmod u+x /opt/mysql/support-files/mysql.server
[mysql@redhat5-db-1 ~]$ which mysql.server
/opt/mysql/support-files/mysql.server
[mysql@redhat5-db-1 ~]$ mysql.server stop
Shutting down MySQL.100331 18:58:49 mysqld_safe mysqld from pid file /data/mysql/redhat5-db-1.pid ended
                                                          [ OK  ]

以上是“Linux 下如何安装配置源代码版本的 MySQL”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-27发表,共计7343字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产成人激情视频 | 国产视频精品免费 | gv天堂gv无码男同在线观看 | 日本高清一级做a爱过程免费视频 | 国产视频精品免费 | 精品国产福利在线观看一区 | 依依成人精品视频在线观看 | av网站的免费观看 | 视频在线观看一区二区 | 成人免费xxxxx在线观看 | 国产精品久久久香蕉 | 久热这里只有 | 亚洲av成人午夜福利在线观看 | h片免费在线观看 | 日本午夜大片 | 丁香婷婷影音先锋5566 | 99热久久国产这里有只有精品 | 午夜爱爱毛片xxxx视频免费看 | 一级特黄aaa大片在线观看视频 | 亚洲在线观看一区 | 国产午夜无码片在线观看影院 | 久久精品www人人爽人人 | 成人在线视频播放 | 免费看污片的网站 | 久久躁狠狠躁夜夜av | 精品国产日韩一区三区 | 中国一级特黄真人毛片免费看 | 成人高辣h视频一区二区在线观看 | 在线免费观看亚洲 | 亚洲码在线中文在线观看 | 无码骚夜夜精品 | 北条麻妃一区二区三区av高清 | 亚洲精品午夜久久久伊人 | 国产成人一区二区动漫精品 | 四虎影视国产精品婷婷 | 亚洲一区综合 | 美女张开双腿让男人捅 | 四虎www成人影院 | 免费a级毛片18禁网站app | 免费人成无码大片在线观看 | 在线黄视频网站 |