码迷,mamicode.com
首页 > 数据库 > 详细

下载mysql5.6源码在linux下安装

时间:2017-03-16 16:11:21      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:修改主机名   pts   sync   erro   tools   分配   添加用户   soc   没有   

下载源码,编译安装.

安装环境 centOS
安装版本: mysql5.6
安装目录: /daan/mysql/5.6
Mysql源代码目录: /daan/tools/mysql5.6  
(下载地址: http://mirrors.sohu.com/mysql/MySQL-5.6/)

 

 
Linux环境提示符修改
echo "export PS1=‘[\u@h \w]\$ ‘" >> /etc/profile
source /etc/profile

修改主机名

vi /etc/sysconfig/network

hostname #name

路由

vi /etc/hosts

安装依赖包 
yum install –y cmake
yum install –y gcc
yum install –y gcc-c++
yum install –y bison
yum install –y bison-devel
yum install –y ncurses
yum install –y ncurses-devel
yum -y install perl*
(或者直接执行yum install -y gcc gcc-c++ bison bison-devel ncurses ncurses-devel cmake perl*)
添加用户
mkdir -p /daan/mysql/5.6/data
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
清理旧的安装环境.(如果没有安装过mysql,不用执行)
make clean
rm -rf CMakeCache.txt
编译
cd /daan/tools/mysql5.6
cmake /daan/tools/mysql5.6 -DCMAKE_INSTALL_PREFIX=/daan/mysql/5.6 
make
make install
cd /daan/mysql/5.6
chown -R mysql:mysql /daan/mysql/5.6
vi /etc/my.cnf
(删除所有内容,copy下面的配置
[mysql]
default-character-set=utf8
[mysqld]
datadir=/daan/mysql/5.6/data
socket=/var/lib/mysql/mysql.sock
log-bin=mysql-bin
server-id=57
innodb_flush_log_at_trx_commit=1 
sync_binlog=1 
pid_file=/var/lib/mysql/mysql.pid
init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
#user=
port=3306
#innodb
default_storage_engine=InnoDB
innodb_buffer_pool_size=64M
innodb_log_file_size=64M
innodb_file_per_table=1
#innodb_flush_method=0_DIRECT
#other
key_buffer_size=64M
log_error=/daan/mysql/5.6/mysql-error.log
slow_query_log=/daan/mysql/5.6/mysql-slow.log
tmp_table_size=64M
max_heap_table_size=64M
query_cache_type=0 
query_cache_size=0
open_files_limit=65535
[client]
socket=/var/lib/mysql/mysql.sock
port=3306
default-character-set=utf8
)
安装默认库
scripts/mysql_install_db --user=mysql --basedir=/daan/mysql/5.6/ --datadir=/daan/mysql/5.6/data/
mkdir /daan/mysql/5.6/init.d
cp support-files/mysql.server /daan/mysql/5.6/init.d/mysql
chown -R root /daan/mysql/5.6
chown -R mysql data
启动mysql
init.d/mysql start
ln -s  /daan/mysql/5.6/bin/mysql /usr/local/bin/mysql
开mysql端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload 
登陆,分配远程呢访问权限
mysql –uroot
GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY root WITH GRANT OPTION;
FLUSH privileges; 
mysql --host=$ip -uroot -p
系统服务
cp /daan/mysql/5.6/init.d/mysql /etc/init.d/mysql
chkconfig --add mysql
chkconfig mysql off
service mysql stop
service mysql start

 

 

 

下载mysql5.6源码在linux下安装

标签:修改主机名   pts   sync   erro   tools   分配   添加用户   soc   没有   

原文地址:http://www.cnblogs.com/reachlins/p/6559908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!