- 浏览: 57359 次
- 性别:
- 来自: 苏州
最新评论
-
se7en8974:
有效。顶一个
老外的lovcombo 使用注意点 -
yekki:
rake rails:freeze:gem与rake rail ...
rake rails:freeze -
tianzhihua:
把你的错误贴上来吧
Struts2 Map 映射 -
myoldman:
我记得java里面integer的最大数值为214748364 ...
Struts2 Map 映射
wget http://mirrors.sohu.com/mysql/MySQL-6.0/MySQL-server-6.0.10-0.glibc23.i386.rpm
wget http://mirrors.sohu.com/mysql/MySQL-6.0/MySQL-client-6.0.10-0.glibc23.i386.rpm
wget http://mirrors.sohu.com/apache/httpd-2.2.16.tar.gz
#卸载Mysql
rpm -qa|grep -i mysql
rpm -ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0
#彻底删除
rm -rf /var/lib/mysql
rm -f /etc/my.cnf
#安装
yum -y install gcc
groupadd mysql
useradd -g mysql mysql
[yum -y install gcc+ gcc-c++]
./configure --prefix=/opt/mysql --with-charset=utf8 --with-extra-charsets=all --with-tcp-port=3306 --with-unix-socket-path=/opt/mysql/var/mysql.sock --with-mysqld-user=mysql --with-federated-storage-engine --with-named-curses-libs=/usr/lib/libncurses.so.5 --without-plugin-falcon
make
make install
scripts/mysql_install_db
cp support-files/my-huge.cnf /opt/mysql/var/my.cnf
======================
用 MySQL 有年头了,写篇简单的文档来记录下自己的常用安装和配置过程。本文旨在介绍如何在 Linux 系统上安装 MySQL 数据库服务器,以及基本配置。本文仅仅提供一份快速指南,请访问 MySQL 官方网站获取详细安装、配置指南。
OS: Red Hat Enterprise Linux AS 3.0
MySQL: 5.0.22
源码 tarball 放置在 /home/huangys , 安装目的地是/opt/mysql
1. 准备
创建一个用户来运行 MySQL 守护进程。
# groupadd mysqlg
# useradd –g mysqlg –M –s /sbin/nologin mysqld
解包
# cd /home/huangys
# tar zxvf mysql-5.0.22.tar.gz
2. 配置编译选项
# cd mysql-5.0.22
# ./configure --prefix=/opt/mysql --with-charset=utf8 --with-extra-charsets=all --with-tcp-port=3306 --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-user=mysqld --with-federated-storage-engine
选项说明:
--prefix=/opt/mysql 将MySQL安装到目录/opt/mysql下
--with-charset=utf8 指定缺省字符集为utf8
--with-extra-charsets=all 将MySQL所有支持的字符集编译进来
--with-tcp-port=3306 指定此MySQL实例将监听TCP 3306端口
--with-unix-socket-path=/tmp/mysql.sock 指定UNIX socket文件的路径(为绝对路径)
--wih-mysqld-user=mysqld 指定用来运行MySQL守护进程的用户
--with-federated-storage-engine 支持federated存储引擎
--with-plugins=innobase 支持innobase数据库(5.1+,默认为空)
--without-debug \去除debug模式
--with-extra-charsets=gb2312 \添加gb2312中文字符支持
--enable-assembler \使用一些字符函数的汇编版本
--without-isam \去掉isam表类型支持 现在很少用了 isam表是一种依赖平台的表 (5.0以前)
--without-innodb \去掉innodb表支持 innodb是一种支持事务处理的表,适合企业级应用 5.0以前)
--with-pthread \强制使用pthread库(posix线程库)
--enable-thread-safe-client \以线程方式编译客户端
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端和客户端
通过指令 configure --help 可以查看全部选项信息。
----prefix 必须指定
--with-unix-socket-path 最好指定自己的路径
优化编译:
1. -static 13%
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static
静态链接提高13%性能
2. -pgcc 1%
CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
-felide-constructors -fno-exceptions -fno-rtti"
如果是Inter处理器,使用pgcc提高1%性能
3. Unix Socket 7.5%
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
使用unix套接字链接提高7.5%性能,所以在windows下mysql性能肯定不如unix下面
4. --enable-assembler
允许使用汇编模式(优化性能)
如:./configure --prefix=/opt/aimcpro10/mysql-5.1.45 --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-unix-socket-path=/opt/aimcpro10/mysql-5.1.45/mysql.sock
--enable-assembler --with-charset=utf8 --with-extra-charsets=gbk --with-plugins=innobase,myisam
3. 编译、安装
# make
# make install
4. 初始化
# scripts/mysql_install_db
这将会在安装目录 /opt/mysql 下创建 MySQL 的数据目录 var
5. 配置
在 MySQL 提供的支持文件中复制一个合适的配置档到 MySQL 数据目录中,并命名为 my.cnf
# cp support-files/my-huge.cnf /opt/mysql/var/my.cnf
主要修改点在 [mysqld] 配置块中:
指定允许的最大包尺寸:
max_allowed_packet = 2M
指定最大连接数(默认为100):
max_connections = 1000
指定服务器端字符集:
character_set_server = utf8
强制指定连接使用的字符集:
init_connect = 'set names utf8'
(注意:若连接时使用的是 super user ,则此项不会被执行,MySQL 文档对此有详细解释。)
指定安装目录和数据目录:
basedir = /opt/mysql2/
datadir = /opt/mysql2/var/
忽略Berkeley DB:
skip-bdb
(同理,若也打算忽略 InnoDB,则使用 skip-innodb)
配置InnoDB:
innodb_data_home_dir = /opt/mysql2/var/
innodb_data_file_path = ibdata1:500M;ibdata2:50M:autoextend
innodb_log_group_home_dir = /opt/mysql2/var/
innodb_log_arch_dir = /opt/mysql2/var/
innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
完成编辑此配置档后,记得顺便修改一下 MySQL 数据目录的 ownership:
# cd /opt/mysql
# chown –Rc mysqld.mysqlg var
6. 控制脚本
MySQL提供了一个脚本文件,可以用来方便地控制MySQL守护进程。
# cp support-files/mysql.server /opt/mysql/bin/mysqlctl
# cd /opt/mysql/bin
# chmod 755 mysqlctl
启动:
# /opt/mysql/bin/mysqlctl start
停止:
# /opt/mysql/bin/mysql stop
注意,若启用了 InnoDB 存储引擎,那么第一次启动 MySQL 服务器时,速度会比较慢,因为需要分配在配置档中定义的空间、生成相应的数据文件、日志文件等。
7. Security
安全问题在哪里都是很重要的,特别是对于初安装的新系统而言,尤其如此。
MySQL 往往携带有四个缺省用户,分别是 'root'@'localhost', 'root'@'%', ''@'localhost', ''@'%'.
除了第一个本地root,其他三个(任意来源的root,以及两个匿名用户)都应该删除:
mysql> use mysql
mysql> delete from user where user='';
mysql> delete from user where user='root' and host='%';
这唯一保留的用户 root@localhost 的密码默认为空,当然不好。为它加上密码:
# /opt/mysql/bin/mysqladmin -uroot -hlocalhost -P3306 -p password my_pass
指令中的 my_pass 就是设定的密码,注意,不要用单引号把它括起来。
8. Appendix
[root@tbox2 root]# cat /etc/redhat-release [root@tbox2 root]# uname -a [root@tbox2 root]# rpm -qa | grep gcc [root@tbox2 root]# rpm -qa | grep glibc [root@tbox2 root]# /opt/mysql/bin/mysql --version
Red Hat Enterprise Linux AS release 3 (Taroon)
Linux tbox2.test.net 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux
libgcc-ssa-3.5ssa-0.20030801.41
gcc-g77-3.2.3-20
gcc-ssa-3.5ssa-0.20030801.41
gcc-objc-ssa-3.5ssa-0.20030801.41
compat-gcc-c++-7.3-2.96.122
compat-gcc-7.3-2.96.122
gcc-c++-3.2.3-20
gcc-gnat-3.2.3-20
gcc-objc-3.2.3-20
gcc-c++-ssa-3.5ssa-0.20030801.41
gcc-java-ssa-3.5ssa-0.20030801.41
libgcc-3.2.3-20
gcc-3.2.3-20
gcc-java-3.2.3-20
gcc-g77-ssa-3.5ssa-0.20030801.41
glibc-headers-2.3.2-95.3
glibc-common-2.3.2-95.3
glibc-utils-2.3.2-95.3
glibc-kernheaders-2.4-8.34
glibc-devel-2.3.2-95.3
compat-glibc-7.x-2.2.4.32.5
glibc-2.3.2-95.3
glibc-profile-2.3.2-95.3
/opt/mysql/bin/mysql Ver 14.12 Distrib 5.0.22, for pc-linux-gnu (i686) using EditLine wrapper
END.
--------------------------------------------------------------------------------------------------------------------
./configure --prefix=/home/jack/mysql/ --with-unix-socket-path=/home/jack/mysql/mysql.sock
make
make install
cp /usr/local/share/mysql/my-large.cnf /home/jack/mysql/my.cnf
cd /home/jack/mysql
bin/mysql_install_db
bin/mysqld_safe &
mysqld_safe
mysqld_multi
mysqlaccess
mysql_upgrade_shell
mysql_install_db
mysqlbug
mysql_fix_privilege_tables
mysql_config (还要改mysql.sock)
msql2mysql
mysql_fix_privilege_tables
mysql_install_db
mysqld_safe
:%s/\/export\/nfs10\/builder\/aimc3rd\/mysql5/\/opt\/aimm\/aimm\/mysql5
然后修改参数
[client]
#password = your_password
port = 3336
socket = /opt/aimm/aimm/mysql5/mysql.sock
default-character-set = utf8
4.启动数据库
./bin/mysqld_safe --defaults-file=./.my.cnf
/mysql -h127.0.0.1 -P3336 -uroot -p
grant all on *.* to aimm@"%" identified by "aimm"
./configure \
--prefix=/usr/local/mysql \
--enable-assembler \
--without-debug \
--with-charset=utf8 \
--with-extra-charsets=all \
--with-pthread \
--enable-thread-safe-client \
--enable-local-infile \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--with-big-tables \
--without-innod \
--without-isam 2;
--with-ssl \
--with-embedded-server \
--enable-assembler \使用一些字符函数的汇编版本
--without-debug \去除debug模式
--with-charset=utf8 \
--with-extra-charsets=complex字符支持
--with-pthread \强制使用pthread库(posix线程库)
--enable-thread-safe-client \以线程方式编译客户端
--with-client-ldflags=-all-static \以纯静态方式编译客户端
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端
--with-big-tables
There is a limit of 232 (~4.295E+09) rows in a MyISAM table. If you build MySQL with the --with-big-tables option, the row limitation is increased to (232)2 (1.844E+19) rows
--without-innodb \去掉innodb表支持,innodb是一种支持事务处理的表,适合企业级应用
--enable-local-infile #让mysql支持从本地文件 导入数据库
--without-isam \去掉isam表类型支持,现在很少用了,isam表是一种依赖平台的表
--with-embedded-server #编译成embedded MySQL library (libmysqld.a)
--------------------------------------
MySQL编译调整优化简明指南
发表评论
-
Spring Security 3.x 完整入门教程
2010-09-06 10:20 2510Spring Security 3.x 完整入门教程 本Blo ... -
setup.linux
2010-09-01 17:05 937yum -y install gccyum -y instal ... -
Linux下创建与解压tar, tar.gz和tar.bz2文件及压缩率对比
2010-08-30 15:48 4789Linux下创建与解压tar, tar.gz和tar.bz2文 ... -
linux下编译安装php的参数
2010-08-27 13:57 1484linux下编译安装php的参数 Fast-CGI: ... -
MySQL+PHP5+Apache安装手记
2010-08-27 13:45 885http://database.51cto.com/art/2 ... -
安装PHP
2010-08-27 11:05 2870yum install g++ yum insta ... -
安装mysql
2010-08-27 10:38 812先检查系统是否装上了mysql,如果有将其卸载掉rpm -qa ... -
rpm
2010-08-27 10:22 1058rpm -qpl xxxxxx.rpm 1.如何安装rp ... -
linux下编译安装php的参数汇总
2010-08-27 10:08 1558Fast-CGI:./configure --prefix=/ ... -
iptables用法
2010-08-27 09:32 2084iptables -A INPUT -p tcp --dpor ... -
linux的chmod,chown命令 详解
2010-08-26 16:38 857指令名称 : chmod 使用权限 : 所有使用者 使用方式 ... -
mysql
2010-08-26 14:21 7081、数据库目录 /var/lib/mysql/ 2、 ... -
Java中根据模板导出数据到word的解决方案
2010-02-25 10:06 5774我们需求如下:给你一个模板,里面有一个表格,标题已经给好,程 ... -
SQL树查询
2010-02-24 17:36 1542引用: --测试数据 深度排序 DEC ... -
基于java的程序OutOfMemory问题的解决及Xms/Xmx/Xss的解释和应用
2010-02-24 16:44 2061长期以来一直都是做java应用的开发,所使用的开发工具基本上也 ... -
neybean支持漂亮的中文
2009-10-13 17:08 0neybean支持漂亮的中文方法如下: -
sychroflow 状态
2009-01-13 18:00 6981. 创建状态 2. 运行状态 3. 挂起 4. 正常 ...
相关推荐
The book teaches the reader to install, configure and set up the PHP scripting language, the MySQL database system, and the Apache Web server. By the end of this book the reader will understand how ...
Install and configure your MySQL 8 instance without any hassle Get to grips with new features of MySQL 8 like CTE, Window functions and many more Perform backup tasks, recover data and set up various ...
to install MySQL 8 on different flavors of Linux, upgrade to MySQL 8 from previous stable releases, and also downgrade from MySQL 8. Chapter 2, Using MySQL, takes you through the basic uses of MySQL, ...
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库 ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目录的软连接 cp ./support-files/...
First find out how to install and configure CentOS. From there, you'll cover a wealth of Linux and CentOS tools, functions, and techniques, including: how to work in the GNOME and KDE desktop ...
Install MariaDB on Windows/RedHat/Fedora/CentOS Linux/Debian/Ubuntu Linux Configure MariaDB to optimize data storage Administer users on MariaDB Learn how to utilize MariaDB to maintain a backup of ...
install-node-msi-version-on-linux-step1 install-node-msi-version-on-linux-step2 在完成下载后,将源码包名改为 'node'。 install-node-msi-version-on-linux-step3 修改目录权限: install-node-msi-...
The selected text compare allows you to select portions of text between 2 files and execute a compare on ONLY the se Using the SSH/telnet console A tutorial for UltraEdit/UEStudio's SSH/telent ...
Table of Contents Preface, Notes, Licenses . . . . . . . . ....1. Licenses for Third-Party Components ....1.1. FindGTest.cmake License ....1.2. LPeg Library License ....1.3. LuaFileSystem Library License ....
For more information on setting file permissions, see "Modifying Linux, Unix, and Mac file permissions" (http://drupal.org/node/202483) or "Modifying Windows file permissions" ...
Mobile systems based on Linux or Mac OS/X (e.g. Android, iPhone, Zaurus, iPaq) HOW TO USE ---------- Type "./configure", followed by "make" to compile hydra and then "./hydra -h" to see the command...
yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --...
php算是这里面最难搞定的,因为我们需要额外的添加php扩展,虽然php的docker官方提供了`docker-php-ext-configure`, `docker-php-ext-install`, `docker-php-ext-enable`,还是有些扩展需要通过`手动编译`或者`pecl`...