Home > Database > Mysql Tutorial > MySQL 5.5.x 编译安装_MySQL

MySQL 5.5.x 编译安装_MySQL

WBOY
Release: 2016-06-01 13:11:18
Original
1048 people have browsed it

MySQL 5.5.x 编译安装

最近开始学习重新整理一遍MySQL的相关知识,以前总是零零散散的学习,现在重新整理一遍,文章当做自己的笔记

系统环境
<code>Distribution : CentOS 6.5 minimal <br>MySQL version : 5.5.36 <br>Init system : sysvinit</code>
Copy after login

1、添加用户组

<code>useradd -r mysql <br>groupadd -r mysql </code>
Copy after login
2、新建数据目录
<code>mkdir -p /mydata/data <br>chown -R mysql.mysql /mydata/data/ </code>
Copy after login
3、安装依赖

之所以安装了openssl-devel是因为下面开启了ssl验证,不安装的话编译不通过,其余的包是官方给出所需要最少需要的包,这里全部安装上

<code>yum install gcc gcc-c++ cmake ncurses-devel openssl-devel bison-devel </code>
Copy after login
4、获取源码包
<code>wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.36.tar.gz <br>#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.16.tar.gz </code>
Copy after login
5、解压缩安装
<code>tar zxf mysql-5.5.36.tar.gz <br>cd mysql-5.5.36 <br>cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /<br> -DMYSQL_DATADIR=/mydata/data / <br> -DSYSCONFDIR=/etc / <br> -DWITH_INNOBASE_STORAGE_ENGINE=1 /<br> -DWITH_ARCHIVE_STORAGE_ENGINE=1 /<br> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 /<br> -DWITH_READLINE=1 /<br> -DWITH_SSL=system /<br> -DWITH_ZLIB=system /<br> -DWITH_LIBWRAP=0 /<br> -DMYSQL_UNIX_ADDR=/tmp/mysql.sock /<br> -DDEFAULT_CHARSET=utf8 /<br> -DDEFAULT_COLLATION=utf8_general_ci <br>make <br>make install </code>
Copy after login
6、生成配置文件,启动脚本,初始化工作
<code>chown -R .mysql /usr/local/mysql/ <br>cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf <br><br>在[mysql]中加入 <br>datadir = /mydata/data </code>
Copy after login
7、初始化库,加入开机启动
<code>/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mydata/data/ <br>cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld <br>chmod +x /etc/init.d/mysqld <br>chkconfig --add mysqld <br>/etc/init.d/mysqld start </code>
Copy after login
8、增加PATH标量
<code>vim /etc/profile.d/mysql.sh <br>export PATH=/usr/local/mysql/bin:$PATH source /etc/profile.d/mysql.sh </code>
Copy after login
9、简单的安全工作
<code>删除匿名用户 <br>mysql> drop user ''@localhost; <br>mysql> drop user ''@node128; //这里我的测试机hostname <br>mysql> drop user root@'::1'; <br><br>修改root密码 <br>mysql> update user set password=PASSWORD('********') where user='root'; <br>mysql> flush privileges; mysql> /q</code>
Copy after login

安装完成之后下面开始从基本的一些之前一些学习的总结

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template