Home  >  Article  >  Database  >  Linux常用工具小结:(2) Mysql的rpm安装和编译安装_MySQL

Linux常用工具小结:(2) Mysql的rpm安装和编译安装_MySQL

WBOY
WBOYOriginal
2016-06-01 13:51:531146browse

Mysql的rpm安装

 

1, 下载。

这里下载http://dev.mysql.com/downloads/mirror.php?id=402502。


2, 安装。

下载到本地解压:

tar -xvf MySQL-5.5.12-1.rhel5.x86_64.tar

安装以下rpm

rpm -ivh MySQL-devel-5.5.12-1.rhel5.x86_64.rpm

rpm -ivh MySQL-shared-5.5.12-1.rhel5.x86_64.rpm

rpm -ivh MySQL-client-5.5.12-1.rhel5.x86_64.rpm

rpm -ivh MySQL-server-5.5.12-1.rhel5.x86_64.rpm

 

3, 配置用户和用户组。

groupadd mysql

useradd mysql –g mysql

 

 

4, 配置mysql配置。

cd /usr/share/mysql/

cp my-medium.cnf /etc/my.cnf #我这里仅仅用来演示应用程序的。

 

5, 运行mysql

mysqld_safe &

 

6, 配置mysql root用户

mysqladmin -uroot password 'password'

 

7, 设置远程用户

create user 'geewu'@'%' IDENTIFIED BY 'password';

GRANT ALL ON *.* TO 'geewu'@'%';

 

Mysql命令行编译

groupadd mysql

useradd -s /bin/false -g mysql -pmysql mysql

 

#安装mysql到home/work/local/mysql

 ./configure --prefix=/home/work/local/mysql /

    --with-unix-socket-path=/home/work/local/mysql/tmp/mysql.sock /

    --with-big-tables --with-plugins=all --with-client-ldflags=all-static --with-mysqld-ldflags=all-static

 make; make install

 

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

允许使用汇编模式(优化性能)

 

 

cd /home/work/local/mysql

 bin/mysql_install_db --user=mysql // 安装默认数据库

 cp share/mysql/my-medium.cnf /etc/my.cnf //复制配置文件(可能需要适当修改)

 cp share/mysql/mysql.server /etc/init.d/mysqld   //复制mysql启动脚本

 chmod 755 /etc/init.d/mysqld //更改mysql启动脚本权限,执行权限必须

 chkconfig --add mysqld   //添加mysql服务

 chkconfig --level 35 mysqld on   //设置服务在运行级3,5启动

 service mysqld start   //启动服务

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn